I am using a png that should be edited to be the exact same length of my World and also to blend seamlessly (I hope) into one another when set end to end, and currently have it working that when I run the scenario it moves left on the X axis slowly to give the appearance it is moving, but I am having trouble finding a method to create another image continuously lined up end to end with the original sandy border the image makes. I would also like to adjust when my "Sand" object is removed at the edge of the world if possible, since the current centerpoint of the image hits the edge and causes it to be removed too early, as once another "Sand" object is created it would leave a large gap. Would it be improper coding technique to create a while loop to create "sand" objects and not increment the loop variable so it never stops creating the objects at certain intervals? What I am using so far is painfully simple:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Sand1 here. * * @author (your name) * @version (a version number or a date) */ public class Sand1 extends Actor { /** * Act - do whatever the Sand1 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(- 1 ); if (isAtEdge() == true ) { getWorld().removeObject( this ); } } } |