Fastest way to move a sprite
Fastest way to move a sprite
I have some code i wrote a while back not handy at the moment that moves card sprites for a game .The code uses a loop to move the sprites from point A to B. The issue is that it's kinda slow what's the best way to make suck a thing move faster across the screen and is there any way to very the speed at all. Any help would be cool thanks..
Re: Fastest way to move a sprite
eddy's post Module - Animation & Motion tween FX contains some great functions to help out with the timing of animations.
Did you ever finish your program or are you just trying to tune it up?
Did you ever finish your program or are you just trying to tune it up?
Re: Fastest way to move a sprite
Trying to tune things up. it's a blackjack simulator. I ran into an issue with other things as well. aka the Random number generator for one but it was using an older version of the compiler.When i update the compiler I will update and audit all the code when i get it running the way i want most of the changes in commands are small but it will still help cut the size of the code a fair bit. also with a stronger Random number generator. The simulator should work as expected.
I dealt Cards in casino's for years here in Canada so i know what it should show based on the rules used to play by. I also know how the rules change the game also. So i know what i should see.
It will take a fair amount of work to get it to where i want it. I got the idea from an older program for windows 3.1 called sage blackjack. I can run it a few different ways on Linux but i want to do something better and more up to date.
I dealt Cards in casino's for years here in Canada so i know what it should show based on the rules used to play by. I also know how the rules change the game also. So i know what i should see.
It will take a fair amount of work to get it to where i want it. I got the idea from an older program for windows 3.1 called sage blackjack. I can run it a few different ways on Linux but i want to do something better and more up to date.
Re: Fastest way to move a sprite
@dan yalte,
For my 2D game engine I use a lot of 2D gaming math ...
And to do that LINEAR motions you need, a "LERP" motion calculation (please look on the internet)
Example:
CardPointA(X,Y)
CardPointB(X,Y)
your CardPointA = Begin of Lerp = 0%
your CardPointB = End of Lerp = 100%
So, your CardMotionX = CardPointA(X)+LerpX%
And your CardMotionY = CardPointA(Y)+LerpY%
Marc,
For my 2D game engine I use a lot of 2D gaming math ...
And to do that LINEAR motions you need, a "LERP" motion calculation (please look on the internet)
Example:
CardPointA(X,Y)
CardPointB(X,Y)
your CardPointA = Begin of Lerp = 0%
your CardPointB = End of Lerp = 100%
So, your CardMotionX = CardPointA(X)+LerpX%
And your CardMotionY = CardPointA(Y)+LerpY%
Marc,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
PS: sorry for my english I speak flemish ...