Results 1 to 8 of 8

Thread: moving stuff

  1. #1

    Thread Starter
    Addicted Member jmiller's Avatar
    Join Date
    Jul 2002
    Location
    University of Michigan
    Posts
    238

    Question 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

  2. #2
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    i always use decimals when doing like that...
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  3. #3
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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)...

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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)

  5. #5
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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....

  6. #6

    Thread Starter
    Addicted Member jmiller's Avatar
    Join Date
    Jul 2002
    Location
    University of Michigan
    Posts
    238
    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.

  7. #7
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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...

  8. #8

    Thread Starter
    Addicted Member jmiller's Avatar
    Join Date
    Jul 2002
    Location
    University of Michigan
    Posts
    238
    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
  •  



Click Here to Expand Forum to Full Width