• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM What is the most efficient method of angle calculation

D

Dopaminestudios

Guest
Hello,

I'm trying to make a sonic like platformer. I would like the player to dynamically change according to the angle of the ground. I don't know what would be the quickest method. I don't want to use the small object/angle variables method because I feel that would become cumbersome and lengthy so i would like to be able to draw the object and find the difference from that point.
 

TheouAegis

Member
Assign a value to each terrain element. When the player's center point is over the tile, use the assigned value to determine what angle the player should be at.

For example:

Code:
0 0 5 4 4 3 0 0
0 6         2 0
0 6         2 0
0 0 7 0 0 1 0 0
If terrain_value is 0, set onLoop to false and image_angle to 0.
If terrain_value is 1 and image_xscale is 1, set onLoop to true.
If terrain_value is 7 and image_xscale is -1, set onLoop to true.
If onLoop is true, set image_angle to 45*terrain_value.
 
D

Dopaminestudios

Guest
Assign a value to each terrain element. When the player's center point is over the tile, use the assigned value to determine what angle the player should be at.

For example:

Code:
0 0 5 4 4 3 0 0
0 6         2 0
0 6         2 0
0 0 7 0 0 1 0 0
If terrain_value is 0, set onLoop to false and image_angle to 0.
If terrain_value is 1 and image_xscale is 1, set onLoop to true.
If terrain_value is 7 and image_xscale is -1, set onLoop to true.
If onLoop is true, set image_angle to 45*terrain_value.
So each of those values is a different object?
 

TheouAegis

Member
Or if you use tiles, different tile... I mean, it's all the same concept. You just find out what tile/object/whatever the player is over, then use that to look up or calculate how to make the player move and angle. It's faster than calculating the shape of the ground
 
D

Dopaminestudios

Guest
So for that method each object would have to have a particular angle value assigned to it correct?
 
Top