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

EricVogel's Comments

Back to EricVogel's profile

Thanks! Ill look at that bug and try to fix it.
I used Greenfoot's getOneIntersectingObject(Obstacles.class) function. It uses the image of both the player and obstacles objects to detect collisions with the object "Obstacles". For example in the player movement code after the player moves right a while block runs to move the player outside the bounds of the image of "Obstacles" object. pseudo code: if ("right" key is down) { move Player right by X } while (getOneIntersectingObject(Obstacles.class) != null) { Move Player to the left one }
Thanks! I am using making this for a final project in my high school programming class.