Results 1 to 3 of 3

Thread: Sprite movement and animation.

  1. #1

    Sprite movement and animation.

    I borrowed an old gameboy bomberman sprite to test it out in my game.

    It just has the Up, Down, Left and Right directions, with 4 frames for each.

    The second frame in each direction is the standing still frame.

    I'm trying to make it so that when you aren't pushing any keys, like movement or attack keys etc, that it shows just the standing animation (I suppose I could let it Loop a 4 frame standing animation.....).

    I use If/Else If/Else If/Else If for checkign IsUp, IsDown, IsLeft and isRight with DXInput for character movement, I then added a Else statement to where I could check which direction the sprite is facing and change it to the standing frame for that direction and tell it not to loop anymore.

    Then during processing of Up, Down etc I would set the animation back to looping again and of course fix up the facing and animstart values.

    But it only animates this way, if I tap the key, if I hold it in, it gets stuck on one of the walking animations (not the standing point one), which is odd.

    So uhh, any ideas? lol.

  2. #2

    Sprite movement and animation.

    Probably easier if you posted your code.
    The views expressed on this programme are bloody good ones. - Fred Dagg

  3. #3

    Sprite movement and animation.

    Well it's been reverted back to normal movement, so it just animates while standing still but I can post that I suppose.

    [pascal]// For Moving our player.
    If (isUp In FrmMain.DXInput.States) Then
    Begin
    Facing := 0; // Facing up.
    AnimStart := Up; // Up walking animation.
    Y := Y - (300 / 1000) * MoveCount; // Move our sprite up.
    End
    Else If (isDown In FrmMain.DXInput.States) Then
    Begin
    Facing := 1; // Facing Down.
    AnimStart := Down; // Down walking animation.
    Y := Y + (300 / 1000) * MoveCount; // Move our sprite down.
    End
    Else If (isLeft In FrmMain.DXInput.States) Then
    Begin
    Facing := 2; // Facing Down.
    AnimStart := Left; // Left walking animation.
    X := X - (300 / 1000) * MoveCount; // Move our sprite left.
    End
    Else If (isRight In FrmMain.DXInput.States) Then
    Begin
    Facing := 3; // Facing Right.
    AnimStart := Right; // Right walking animation.
    X := X + (300 / 1000) * MoveCount; // Move our sprite right.
    End;[/pascal]

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
  •