For the Game Frame, I needed to add restrictions so that the trolley would not go off screen, but simply top once it has reached a certain limit.
Heres the code --->
function moveTrolley():void
{
if(isRightKeyPressed == true && trolley_mc.x < 370)
{
trolley_mc.x += TROLLEY_SPEED;
}
if(isLeftKeyPressed == true && trolley_mc.x > -80)
{
trolley_mc.x -= TROLLEY_SPEED;
}
}
I added the "&& trolley_mc.x < 370" to make the Trolley stop at the right side of the screen,
and the "&& trolley_mc.x > -80" to make it stop on the left.
No comments:
Post a Comment