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

2014/5/6

Borders?

SullyFish SullyFish

2014/5/6

#
So Im working on a game with a little character who moves in all 4 directions, but there is a scoreboard on the right hand side and Id like to make it so that the actor cant touch the scoreboard/bounces off. The scoreboard is 105, 600. Could anyone help?
erdelf erdelf

2014/5/6

#
well, implement this borders in your moving code
SullyFish SullyFish

2014/5/6

#
how so?
erdelf erdelf

2014/5/6

#
well, in your moving code write something like this (pseudo) if x-loc is higher then 100, then dont move to the right side else, move
danpost danpost

2014/5/6

#
Just move and check for intersection with scoreboard object; if intersection occurs, move back and reverse direction of movement (bounce).
SullyFish SullyFish

2014/5/7

#
Alright thank you guys!
You need to login to post a reply.