Hi, I started playing around with this concept called sprite stacking, and its of a car, and I wanted to implement movement. I didnt want regular movement, I wanted to implement steering movement. After alot of trial and error and alot of ghetto code I figured I should ask because there must be an easier way.
So I would really appreciate if someone could point me in the right direction please (or steer me in the right direction).
Heres the demo just in case you want to check how it could be implemented.
Steering Movement Help
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Joelrodiel
- Prole
- Posts: 27
- Joined: Wed Apr 20, 2016 3:40 am
Steering Movement Help
- Attachments
-
- demo.love
- (3.67 KiB) Downloaded 127 times
-
- Prole
- Posts: 1
- Joined: Fri Aug 11, 2017 12:18 pm
- Location: Lithuania
Re: Steering Movement Help
Hey, basically what you need are these two lines:
If you are not familiar with trigonometry, I suggest googling about how sin/cos (atan2 might also help you in the future) works.
I'm attaching your modified demo, feel free to ask if something is not clear there - i was too lazy to write comments
Code: Select all
player_x = player_x + math.cos(player_r) * speed * dt
player_y = player_y + math.sin(player_r) * speed * dt
I'm attaching your modified demo, feel free to ask if something is not clear there - i was too lazy to write comments
- Attachments
-
- demo.love
- (3.95 KiB) Downloaded 135 times
- Joelrodiel
- Prole
- Posts: 27
- Joined: Wed Apr 20, 2016 3:40 am
Re: Steering Movement Help
Thank you so much that's exactly what I needed!!BetonineAntis wrote: ↑Sun Sep 24, 2017 8:57 pm Hey, basically what you need are these two lines:
If you are not familiar with trigonometry, I suggest googling about how sin/cos (atan2 might also help you in the future) works.Code: Select all
player_x = player_x + math.cos(player_r) * speed * dt player_y = player_y + math.sin(player_r) * speed * dt
I'm attaching your modified demo, feel free to ask if something is not clear there - i was too lazy to write comments
Re: Steering Movement Help
This demo got me interested out pseudo-3d stuff.
Who is online
Users browsing this forum: Bing [Bot] and 4 guests