Determine Player Altitude (Sidescroller Demo)?
by Tim Muenstermann · in Torque Game Builder · 11/22/2005 (1:48 pm) · 2 replies
The premise is that the player is bombing targets at the bottom of the screen. I award the player points when they hit a target. Simple.
I want to take it a step further and as the player moves up/down I want to be able to include a points modifier that takes into account the "altitude" of the player. Since 0,0 is the middle of the screen it's not as simple as grabbing an x or y value.
I've tried to find anything in the codebase that makes this a simple task in script, but I'm just not finding anything (only had T2D for about a week).
Any suggestions?
I want to take it a step further and as the player moves up/down I want to be able to include a points modifier that takes into account the "altitude" of the player. Since 0,0 is the middle of the screen it's not as simple as grabbing an x or y value.
I've tried to find anything in the codebase that makes this a simple task in script, but I'm just not finding anything (only had T2D for about a week).
Any suggestions?
About the author
#2
Thanks!
-Tim
11/22/2005 (3:13 pm)
@Luke: The second idea is perfect. I can just use the enemy objects that are being bombed to get the "floor" value. Great suggestion... and simple too.Thanks!
-Tim
Torque 3D Owner Luke D
Default Studio Name
You could move the camera so 0,0 is elsewhere (like the bottom corner) to make the player's altitude more obvious. This is pretty crude approach.
You could put an object that is considered the 'ground' and do a quick calculation of getWord(%player.getPosition(),1) - getWord(%ground.getPosition(),1) to figure out altitude
You could grab the T2D viewport dimensions (using getWindowExtents) and use those values to calculate where the bottom of the screen is and use that for 'ground' level
There are probably others, but one of those might be enough to get you going in the right direction.