Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Compare Position
Old
XenElement
Junior Member
 
XenElement's Avatar
 
Status: Offline
Posts: 3
Join Date: Dec 2011
Default 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.
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 12-24-2011, 03:58 PM

Quote:
Originally Posted by XenElement View Post
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>
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 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
   
Reply With Quote
Old
waqar
Senior Member
 
Status: Offline
Posts: 51
Join Date: Sep 2011
Location: Pakistan
Default 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
   
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump



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