|
-
Dec 3rd, 2002, 10:39 PM
#1
Thread Starter
Addicted Member
moving stuff
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
-
Dec 4th, 2002, 03:34 AM
#2
Frenzied Member
i always use decimals when doing like that...
-
Dec 4th, 2002, 05:47 AM
#3
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)...
-
Dec 4th, 2002, 07:44 AM
#4
Good Ol' Platypus
Bitblt will accept non-integral numbers, but it will simply chop off the decimal part (leaving you with an integer).
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Dec 4th, 2002, 08:01 AM
#5
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....
-
Dec 6th, 2002, 03:38 PM
#6
Thread Starter
Addicted Member
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.
-
Dec 6th, 2002, 08:02 PM
#7
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...
-
Dec 8th, 2002, 05:45 PM
#8
Thread Starter
Addicted Member
its not that much of a problem, i can just change the speed to something like 1.0001
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|