hi, im making a snake game where u can steer to the left and right with 2 buttons smoothly. the snake's speed is gonna be the same all the time while u are turning left or right.
the problem im having is that i dont know the math for it.
if u know it i'd be very grateful if u could share ur knowledge.
hi, im making a snake game where u can steer to the left and right with 2 buttons smoothly. the snake's speed is gonna be the same all the time while u are turning left or right.
the problem im having is that i dont know the math for it.
if u know it i'd be very grateful if u could share ur knowledge.
p.s im using cocos2d.
You're going to have to be more specific. How are you representing motion? Do you have a delta that you apply to the snake for each frame? Are you using compass directions? What is the coordinate system in Cocos2D? (center of the screen is 0,0, with positive movement up and to the right, or is the zero point in the upper left, with increases in x and y going right and down?
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
How are you describing the direction of movement? How do you move the snake to a new location if it doesn't steer? I'm not going to write your whole program for you.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.