Log In  
Follow
simonwilson
Follow

I need some help with the math for making an object move between 2 fixed positions, then slow down smoothly to the final position.

The cart contains my attempt to make this work but I cannot quite reach the end point, and therefore the mode variable does not change.

Can anyone see what is missing here, and what could I do to make the last few steps a bit faster? (It slows to a crawl at the end...!)

Many thanks in advance :)

Cart #demenifji-0 | 2022-08-17 | Code ▽ | Embed ▽ | Forks ▽ | License: CC4-BY-NC-SA
1

P#115949 2022-08-17 19:02

Hello :)

(Forever) Beginner level programmer here!

I have been trying to make a top down driving game, and rather than reinvent the wheel I figured I could take some existing carts and use the code to make a player that uses a sprite that can rotate, and move forward and backward.

I found this post for the sprite rotation, which works exactly as I would like, although I can't really grasp how the function is working: https://www.lexaloffle.com/bbs/?pid=52525 (example1)

Then I found a cart of Asteroids by @mccolgst: https://www.lexaloffle.com/bbs/?tid=29903, stripped out all the stuff I didn't need (example2), and have been going between these 2 carts to try and combine the sprite rotation function with the desired movement.

Unfortunately I hit a wall and my latest effort was example3, but I'm quite lost honestly.

Can anyone shed some light on how these carts work and how I could go about applying a forward movement to a rotated sprite?

Many thanks in advance!

Cart #example1-0 | 2022-01-18 | Code ▽ | Embed ▽ | Forks ▽ | No License

Cart #example2-0 | 2022-01-18 | Code ▽ | Embed ▽ | Forks ▽ | No License

Cart #example3-0 | 2022-01-18 | Code ▽ | Embed ▽ | Forks ▽ | No License

P#105335 2022-01-18 18:25

Cart #animmario-0 | 2021-09-08 | Code ▽ | Embed ▽ | Forks ▽ | License: CC4-BY-NC-SA

Hello!

I am going a bit mad trying to figure out how to make a simple 4 frame sprite animation run on a loop, and then transition to a different 4 frame animation loop after a button is pressed.

Simply - I am trying to make this Mario sprite look like it is walking forward when idle, or pressing forward, and then look like he is walking sideways when pressing left or right. I can make him animate on loop when idle, but I cannot figure out how to make it animate as a different sequence after a direction is pressed, and ensure the animation runs smooth (for example, I can get it to change to the new sequence, but holding the button down keeps the sequence locked into the first frame of the animation).

I hope that makes sense! Does anyone have a simple solution?

P#97078 2021-09-08 21:39

Hello!

I am developing a small hockey type game where the player character can move in all directions. It works fine enough but because of the D-pad movement, if the player tries to go in a circle, its very much a diamond shaped movement instead.

I am not sure if there is any way to make this movement smoother, so its circular if you hit the buttons in quick succession like the below gif image?

Any suggestions or feedback are most welcome! :) Thanks!

Cart #testinghockey-0 | 2021-07-21 | Code ▽ | Embed ▽ | Forks ▽ | No License

P#95130 2021-07-21 15:44 ( Edited 2021-07-21 15:46)

Cart #ufoshooter-2 | 2021-02-13 | Code ▽ | Embed ▽ | Forks ▽ | License: CC4-BY-NC-SA
6

P#87584 2021-02-13 11:03 ( Edited 2021-02-13 13:15)

Follow Lexaloffle:        
Generated 2022-10-03 00:54:47 | 0.069s | Q:30