Alice Community Compare Position

 Compare Position
 XenElement Junior Member     Status: Offline Posts: 3 Join Date: Dec 2011 Compare Position - 12-24-2011, 12:01 PM This may be a stupid question, but I'm having a heck of a time finding the answer to it. How do I compare position using an if statement? I'm creating a false 2D game, and I need to know when the hero has gone off the camera's view, of out of the bounds of the stage. I know what the values are for the edges of the camera, but I can't seem to figure out how to compare the hero's position to those single values using an if statement. My real objective is to teleport the hero to the other side if he goes off the screen, just like asteroids, so if anyone has a better method of doing that, please let me know.
dakota95
Senior Member

Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
12-24-2011, 03:58 PM

Quote:
 Originally Posted by XenElement This may be a stupid question, but I'm having a heck of a time finding the answer to it. How do I compare position using an if statement? I'm creating a false 2D game, and I need to know when the hero has gone off the camera's view, of out of the bounds of the stage. I know what the values are for the edges of the camera, but I can't seem to figure out how to compare the hero's position to those single values using an if statement. My real objective is to teleport the hero to the other side if he goes off the screen, just like asteroids, so if anyone has a better method of doing that, please let me know.
what you can do is place two objects, one at each end of the screen, and say if guy is within x meters of object 1, move to object two.

<Insert_Signature_Here>

 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 12-24-2011, 05:43 PM It would work better with "too the left/right of" so that you play the method when the guy passes it, instead of is on it, so you don't need to position it perfectly -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ
 waqar Senior Member   Status: Offline Posts: 51 Join Date: Sep 2011 Location: Pakistan 12-26-2011, 09:48 AM well if i want to do that thing i would place a variable for camera and calculate the number of increments by incrementing that variable by 1 with every 1 meter of camera move then place an if else statement and put if Camera Movement(Variable)== x do the teleport method

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge