Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Scrolling "jerky"

  1. #11

    Scrolling "jerky"

    Quote Originally Posted by Traveler
    He has to come to a rest exactly on a tile then (so he's up exactly against the wall) doesn't he?, so surely the same problem applies? Err.r.......
    In a platform game I would check for the wall. But, the sprite doesn't necessarily have to stop walking when he reaches the center of the tile. (What if your sprite is very narrow and your tiles very large)
    But yes, you are right when you say that in theory the same problem applies.

    If there is a wall in the sprite's path I usually calculate the number of pixel to the wall, and then use that information for the next update.

    Say pixels to wall = 4, and sprite speed = 5 then in the next update the speed is not 5 but 4. (or 2 to have some room between the sprite and the wall)

    I believe you could do the same thing. Detect the kind of tile in front of the current tile and handle accordingly. If there's no obstacle, do nothing, else calculate the remaining pixels (in your case to the center of the tile).
    Yes, my player is exactly the same size as a tile and I want him never to stop between a tile (like a chess piece always slides onto the the next tile).

    When the player presses "right" he slides over one tile to the right and should stop, unless you're still holding "right" so you continue moving.

    This only works now because I'm checking that on the next move (whatever speed) he doesn't go over and snaps to the next tile (jerkying).

    I'm trying to think of a similar Windows game that plays like that so I can see one working right.

    Can you/anyone think of a game where the player takes up one tile, slides between them but only allows you to stop exactly on a tile and not between?

  2. #12

    Scrolling "jerky"

    Just to let you know (if you're interested!), I've managed to solve my problem. Well, my programming one anyway! :-)

    What I've done is when the player chooses to travel in a direction I make a note of a destination "stop" point (+32 pixels)

    Then as he travels (at the varying pixel rate) I check to see if he has reached or exceeded the "stop" point.

    If he has I then (this is the crucial bit) check to see if he is requesting and is able to travel to the next tile. If he does he simply is allowed to continue after increasing the "stop" point by 32 again.

    If he dosn't want to continue, or isn't able to, I then stop him at the correct point (ie the stop point) so stopping him exceeding it. This effect means the player is never able to stop inbetween any tiles but is allowed to continue smoothly is he wishs.

    The difference is amazing. Super smooth scrolling!


    Thanks again for your feedback.

    One question you might be able to help with, do I have to call QueryPerformanceFrequency() for every frame, or is that fixed depending on the processor?

  3. #13

    Scrolling "jerky"

    it's constant

  4. #14

    Scrolling "jerky"

    Quote Originally Posted by Paulius
    it's constant
    Cheers!

  5. #15

    Scrolling "jerky"

    Nice to know you have solved the puzzle.
    Any chance we can see the solution in action?

  6. #16

    Scrolling "jerky"

    Quote Originally Posted by Traveler
    Nice to know you have solved the puzzle.
    Any chance we can see the solution in action?
    Sure thing:-

    http://thedamot.mailcan.com/ScrollingExample.zip

    Please ignore the strange programming style.

    Just use the cursor keys to move the "player" around. ESC to exit.


    Cheers!

  7. #17

    Scrolling "jerky"

    Really quite nice! The scrolling is indeed very smooth. Also the movement of the player is really nicely done. I haven't yet checked your code, but I'm going to have a look at it later.

    Actually it's not a platform game and it's very important that the player doesn't stop between tiles.
    I'm really wondering about the next update. Please by all means, keep us posted!

  8. #18

    Scrolling "jerky"

    Quote Originally Posted by Traveler
    Really quite nice! The scrolling is indeed very smooth. Also the movement of the player is really nicely done. I haven't yet checked your code, but I'm going to have a look at it later.

    Actually it's not a platform game and it's very important that the player doesn't stop between tiles.
    I'm really wondering about the next update. Please by all means, keep us posted!
    Thanks. I'm pleased how it's turned out. Forget my coding, it's very messy, but the principle's right.

    What I really want to do is move away from DelphiX and write my own code.

    I'm not interested in 3D or anyway, just 2D stuff like this. But where do I start?

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •