PDA

View Full Version : Setting boundaries for moving objects?


BigOrangeArmy
10-19-2009, 03:44 PM
So, I'm creating a "game" that has a person moving left to right when "the button is pressed." Problem is, how would you restrict distances you could go? Like not to move past a certain tree so many meters, for instance? Any help would be great, thanks :)

---BigOrangeArmy

Nickto1414
10-19-2009, 06:02 PM
ill make an example program and explain that hold on lol

so this is how it works
when the world starts it runs a loop of if statements of
if camera is withing 5 meters of box
then move camera back 10 meters
and it keeps on runing that over and over and over ect. lol
but only 1 bug.
when you backup into it it doesnot work, i dont know howto fix this but when i find out ill post it.

file of example in attachments (: hope this helped

Jeremytroid
10-19-2009, 06:03 PM
Put an "if/else" statement then "true" and make (under functions) "[object] is with in threshold of[object]"
then under the "if" and "else" parts put the methods you want the world to do.:p

BigOrangeArmy
10-20-2009, 08:28 AM
ill make an example program and explain that hold on lol

so this is how it works
when the world starts it runs a loop of if statements of
if camera is withing 5 meters of box
then move camera back 10 meters
and it keeps on runing that over and over and over ect. lol
but only 1 bug.
when you backup into it it doesnot work, i dont know howto fix this but when i find out ill post it.

file of example in attachments (: hope this helped

Yeah, thats happened before to me with the loop :(. Thanks for the help though.
I think I'll just make the world go black and a "Game Over" message appear after the said object moves past the camera bounds (which I marked with some nice-looking DX7 trees :p haha.)

The If/Else function sounds like it could work though. But you just might get the loop effect like Nickto1414 said.

Thanks guys, really appreciate it :)