Using Velocity to change direction?
Evening,
Im having my actor bounce around the screen as mentioned in other posts, but i want it to change direction everytime it hits a wall (top, bottom, left or right) to a random direction? Can you use the velocity attribute within the actor and if so, which direction is 0?
Cheers
Im having my actor bounce around the screen as mentioned in other posts, but i want it to change direction everytime it hits a wall (top, bottom, left or right) to a random direction? Can you use the velocity attribute within the actor and if so, which direction is 0?
Cheers
Comments
Left is Negative on x and down is negative y
0 is no movement.
and just to clarify I am talking about self.linearvelocity.x and self.linearvelocity.y
Hope that helps
I would learrn how the X and Y co-ordinates work, you are going to need this a lot!
The way I learned was by drawing an iPhone screen on a piece of paper and writing where x = 0, y = 0, x = 480 and y = 320, then its easy to find the co-ordinates of any position on screen relative to another position.
You can also try this free app which will help you a lot too
http://gamesalad.com/game/idevices
It has nothing to do with the question you have asked. It sounds to me like you are trying to go the really hard way to have collisions when what you need to do is just put walls around the edge and make your actor collide with the walls.
If what I said still sounds like its over your head you need to go back the the wiki/help page on this site and the cookbook videos and learn more about using GS. Cause thats really basic stuff.
Sorry mate but you gotta walk before you can run.
Good luck. I hope that helps you.
Aaron
___________________________________________________________________________________
TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes