Jump to content
  • Advertisement


Sign in to follow this  
  • entries
  • comments
  • views

Battle animations

Sign in to follow this  


When an Actor has something happen to him, drinks a potion, gets hit by a spell, etc... All of these things usually require an extra animation ontop of the Actor, but again below the things obstructing the actor from the above view. For instance if the wall is in front of the bottom portion of the actor, you don't want a battle animation to be above the wall.

To get around this there are now these layers in the game:

  • Pictures (Above everything including walls)

  • Battle Animations

  • Actor Level 5 (General Actor Layer)

  • Actor Level 4 (General Actor Layer)

  • Actor Level 3 (General Actor Layer)

  • Actor Level 2 (General Actor Layer)

  • Actor Level 1 (rocks, taller grass etc...)

  • Terrain

It was rather a suprise to find that Adding this many layers wasn't a slow down for the game... This is because the Tile class looks like this:

class Tile {
private int[] Actors;
private String sck;
private boolean draw;
private int shade;

and the Drawing algo looks like this:

for (int y = 0; y for (int x = 0; x drawImage(getTile(x,y).getSck(), x, y);//DRAW TERRAIN
for (int l = 0; l drawImage(getTile(x,y).getActor(l), x, y);//DRAW ACTOR LAYERS

Where the drawImage() method is different from the Graphics2D drawImage. If the int value passed to it is 0 or null it doesn't render it. So there is hardly any slow down at all for adding one more layer...

So now in the ProccessCommand() method in my Status class there is something defined as 'JTU: playBA a x y' which will play an Animation (a) at the x y coordinate, but still keep it below the obstructing terrain... joy! [smile]
Sign in to follow this  

1 Comment

Recommended Comments

Nice, though I don't see why you'd draw the animation over the actor. Why not just change the actor bitmap/src coordinates? (ie, blit a different frame from the same image)

EDIT: Duh. You're drawing a potion/spell/etc over the actor. I gets whats goings ons heres... [wink]

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!