This site requires JavaScript, please enable it in your browser!
Greenfoot back

danpost's Comments

Back to danpost's profile

@Nosson1459, I had to modify the codes you were interested in. Please note the changes in the 'selectable actor follow scrolling code' scroll methods.
@tkiesel, you suggested this: // find a similar positive value for scroll positions if (imageX < 0) { imageX %= wide; imageX += wide; } if (imageY < 0) { imageY %= high; imageY += high; } // get new starting positions for drawing 'scrollImage' imageX = imageX%wide; imageY = imageY%high; which does indeed work (I, for some reason, was under the impression that all mod returns were positive -- apparently, on negative values, when there is a remainder, the value returned is negative; hence, the confusion). Even better, then, would be this: // find a similar near-zero value for scroll positions imageX = imageX%wide; imageY = imageY%high; // adjust for negative values if (imageX < 0) imageX += wide if (imageY < 0) imageY += high;
@Nosson1459, the 'selectable actor follow scrolling code' example shows how to govern the scrolling speed while following an actor.
@Nosson, start a discussion thread on this. Be more detailed in your description. Also, if you could describe the platform scenario of which you mentioned (I do not believe that anything is "missing").
The challenge is possible, but you would be challenging the impossible.
@tkiesel, by 'freeware', I mean the code is not under any license of any kind and is free to use at will. I have found one bug in the class which I will need to address (hopefully today). It is in the unlimited, no-background image scrolling part of the scroll method where the scrolling offsets fail to be updated.
@tkiesel, as far as adding the line (again), I was incorrect when I said "calling scroll from the world constructor is useful in crating the initial background image sometimes". This is actually being done by both the Scroller class constructors -- calling scroll with both parameter values of zero (see lines 46 and 77). So, not "sometimes"; but, "all the time". Adding your line would prevent these calls from doing their functions (setting the initial background image of the world).
@tkiesel, the code was created completely by myself and is presented as freeware.
@tkiesel, I think the calling statement should check that condition for scrolling. Calling scroll from the world constructor is useful in creating the initial background image sometimes and adding your line there would conflict with that.