Jump to content

Yar

Sign in to follow this  
  • entries
    208
  • comments
    383
  • views
    65968

Battle animations

Sign in to follow this  
H_o_p_s

96 views

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;
//SNIP METHODS
}

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
}
}
}
//LOOP THROUGH THE PICTURES ARRAYLIST AND RENDER THEM AS WELL

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!