Sorry if this obvious to everybody else, but it isn’t to me.
I have looked through a whole bunch of sample code for apps that have levels and how they determine when the level is complete, but most are based on scores. In my game I want the level to be complete when the ball touches the goal area. I tried something like
function levelComplete()
if ball.x > ? and ball.x < ? and ball.y > ? and ball.y < ? then
and then I put something here like redRect:rotate(90)
end
But that didn’t work. Then I saw another way to do it would be to use a function from another sample I saw where it got the distance from the ball to the goal and if it was less than whatever you set it to, something would happen
I understand that this is most likely my fault, It would just be great if I knew what had to be fixed
PS- I didn’t actually put ?, I just dont have the #s off the top of my head.
I just tried adding one, but I am not sure I did it right.
function levelComplete(event)
if ball.x > 0 and ball.x < 1000 and ball.y > 0 and ball.y < 1000 then
redRect:rotate(90)
end
Runtime:addEventListener(“enterFrame”,levelComplete)
Still doesnt work anyway,
thanks [import]uid: 7116 topic_id: 5675 reply_id: 19468[/import]
ah! well that fixes the syntax error, but redRect isn’t rotating. In the end I want to have something else happen besides making the red rectangle rotate, but I thought I would use this as an example. And I made the values big enough and the ball is on the screen within those values so… [import]uid: 7116 topic_id: 5675 reply_id: 19471[/import]