How do I make 8 direction animations shoot in 360 directions

0 favourites
  • 6 posts
From the Asset Store
JPEG format 364x HD backgrounds in 2688 x 1536 Resolution
  • What I need:

    Character has sprites for 8 directions. He is a turret and can shoot in 360 directions. How do I make this look good?

    Is there a way to rotate/skew sprites to adjust the direction of pointing?

  • You can create a fairly convincing rotational effect with 8 directions, depending on how you've drawn your graphics.

    You can have smooth rotation of your object, and change it's directional animation at the points where 16 angles would exist; IE Change from 0 to 45 degree animation at angle ~22.5 degrees.

    If you're using isometric sprites then this will probably not work very well (especially for human-type characters) but you may get away with it for certain objects (things like a moving vehicle tend to work out OK using this method). I find this works best using pseudo-isometric sprites (games like Legend of Zelda).

    Of course if your game is overhead/birdseye view then you can do it with simply 1 angle only, so I assume you're using isometric?

    ~Sol

  • You can create a fairly convincing rotational effect with 8 directions, depending on how you've drawn your graphics.

    You can have smooth rotation of your object, and change it's directional animation at the points where 16 angles would exist; IE Change from 0 to 45 degree animation at angle ~22.5 degrees.

    If you're using isometric sprites then this will probably not work very well (especially for human-type characters) but you may get away with it for certain objects (things like a moving vehicle tend to work out OK using this method). I find this works best using pseudo-isometric sprites (games like Legend of Zelda).

    Of course if your game is overhead/birdseye view then you can do it with simply 1 angle only, so I assume you're using isometric?

    ~Sol

    Thanks for your reply.

    No, its not isometric. It's top down/view from front.

    I don't really understand what you mean with 16 angles. Do you mean I should rotate the sprites from 22.5° to 45° i.e.?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, it sounds like what I'm calling "pseudo-isometric" - where the graphics are drawn from a frontal, but slightly "above" angle.

    Ok so, you have your 8 directions ( 0 degrees, 45 degrees, 90 degrees, 135 degrees, 180 degrees, and so-on) - these are the angles you actually move at, but if you go half-way in between each of these angles to make a total of 16 angles ( 0 degrees, 22.5 degrees, 45 degrees, 67.5 degrees, 90 degrees, 112.5 degrees, 135, etc etc).

    The idea is to use the 8 angles "in-between" your actual directions, AND the actual directions themselves, as a trigger for changing animations/frames. So, you rotate your sprite smoothly (360 degrees spinning, like car behaviour for example) and you use the angular measurement (range) to set the correct animation.

    Imagine using smooth turning instead of 8-directinonal movement

    -----------------------------------

    Pseudo code:

    If player.angle is between 337.5 and 22.5 (the character will be facing right within 45 degrees) -> set animation/frame to "right"

    If player.angle is between 22.51 and 67.5 -> set animation/frame to "right/down"

    If player angle is between 67.6 and 112.5 -> set animation/frame to "down"

    etc, etc

    This should give you the freedom to rotate your sprite smoothly, and it will change animation frames/angles that match your artwork.

    I'm doing something very similar to this myself actually using 8 directional movement, but I'm rotating my player around only 6 directions from a display point of view. I translated what angles I wanted to display the direction I am moving in graphically, so my "left" is the same as my "diagonally left/down" and "right" is the same as "diagonally right/down". It's kinda hard to explain, but hopefully you got something from that. I can maybe make an example or share some prototype I'm working on if you get stuck still. Cheers!

    ~Sol

  • I'm confused. I know how to make a rotation between those 8 sprites. What you're saying is you're using 16 angles, however I can't seem to notice what exactly is giving you 16 angles. Do you use 16 sprites or do you rotate them? Sorry, maybe I'm just stupid.

    My problem is that when my sprite is facing 45° angle but is shooting towards 65° angle it looks bad. I'd like to know if I can somehow adjust my sprite slightly to make this look better.

  • I'm using an angle *range*, not 16 angles.

    To get the correct angles to make something like this work, you have to know all the angles "in between" the standard 8 directional angles (The standard 8 directional angles IE; 0, 45, 90, 135, 180, 225, 270, 315)

    You need to find the point that's half way between each of those angles, to create an angle "range".

    See attached (badly drawn) diagram. Hopefully this will clear things up;

    https://www.dropbox.com/s/fvns8tk4pvdk6im/angles.png?dl=0

    So you only use 8 directions of actual animation/graphics but you change the frame or animation sequence based on a range of angle.

    As I mentioned originally, this effect looks better with objects like cars/vehicles and not-so-much for a character sprite.... but that totally depends on how you've drawn your artwork as well. You will need to experiment to see if something like this will do what you're looking for.

    ~Sol

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)