PDA

Click to See Complete Forum and Search --> : moving stuff


jmiller
Dec 3rd, 2002, 09:39 PM
I want to take a poll:
in all the games you've made, how do you go about moving your sprites? Do you move them every frame? If so, do you make them faster by moving them more than one pixel per frame? How do you deal with the jerkiness that comes with moving more than 1 pixel per frame?
If not, do you base speed off of how often it moves(eg, 1 px every other frame, or 1 px every three frames, and so on)?
I'm asking because i have a game that runs at 100 FPS. If i only move each image at 1 px per frame, that 100px per second. And thats the slowest it can go. If i decide to base movement off of framecounts, thats the fastest it can go(eg, every frame is 100px/sec, every other frame is 50px/sec...). I'd like to know whats the best way to go about this. Also, when you call bitblt, can the x,y values be decimals, like 1.5?
thanks

cyborg
Dec 4th, 2002, 02:34 AM
i always use decimals when doing like that...

NoteMe
Dec 4th, 2002, 04:47 AM
Originally posted by cyborg
i always use decimals when doing like that...

Me too, I'm always using a double, then it can move 0.5 or 1.5 pixels at the time...(It looks like he is moving 0.5, but actually he is moveing 0pixels one time, and 1 pixel the next, but it looks smooth)...

Sastraxi
Dec 4th, 2002, 06:44 AM
Bitblt will accept non-integral numbers, but it will simply chop off the decimal part (leaving you with an integer).

NoteMe
Dec 4th, 2002, 07:01 AM
Originally posted by Sastraxi
Bitblt will accept non-integral numbers, but it will simply chop off the decimal part (leaving you with an integer).


That was more or less what I sead....

jmiller
Dec 6th, 2002, 02:38 PM
I've changed both the speed variables and the x and y variables of my program to double. This works good except for one problem. When i set the speed to 1, one of the directions (never both) is jerky. I can't figure out why. What's interesting is that i can change the value of the speed to 1.000001 and it will move at the same speed, but the jerkiness will be gone. What is the deal with '1'? If you need code, post up and i'll attach the project.

NoteMe
Dec 6th, 2002, 07:02 PM
I have no idea of what the problem might be, but if you post up the code, I can take a look at it, but I doubt I will have an answer for you...

jmiller
Dec 8th, 2002, 04:45 PM
its not that much of a problem, i can just change the speed to something like 1.0001