Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Compare Position (http://www.alice.org/community/showthread.php?t=7860)

XenElement 12-24-2011 12:01 PM

Compare Position
 
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 12-24-2011 03:58 PM

[QUOTE=XenElement;45062]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.[/QUOTE]

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.

TauTrumpsPi 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

waqar 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 :)


All times are GMT -5. The time now is 04:29 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.