HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

TD: 2D towers shall aim in 90°

04-06-2010, 04:24 PM#1
MasterofSickness
Hi!

I captured some pics of the old SNES game Secret of Mana (also called Seiken Densetsu or so). I want to make a TD where the towers are 2D-Arts. I already got animated mdls and mdx models, but now I don't know, how to set up a good system. The Arts have animations for 4 directions. They can look left, right, forward and backward. Now I need a system that checks where the attacked enemy is. If the enemy is on the left side of the attacking tower, then the tower should play its left animation. If the enemy is beneath the tower, then the tower should play its forward-animation. Yes, that is the problem. And I don't know where to start. I need a system which looks for all the towers and letting the towers play their appropriate animations like the pathing enemies are located. So, it needs to be a good system, because of many events the whole time... I have the 'JassNewGenPackv5d' on my system and some experience in jass, but I haven't done anything in WE since around 2 years... So, hopefully you can give me a solution?

Edit:
I will try to use "SetUnitAnimationByIndex", but some hints would be nice...
04-07-2010, 02:26 PM#2
Earth-Fury
a = angle between units tower and target

if a > 315 || a < 45 then face up
elseif a > 225 then face left
elseif a > 135 then face down
else face right

This presumes a is normalized to 0..360 and 0 degrees is up.

As for playing animations: ByIndex is the best method.

As for detecting when to do the facing: In the generic "on attacked" event. When a unit is attacked, and the attacker is a tower who's facing is snapped to 4 directions, set the animation.

Note that I do believe attacking resets animations, even if done by index. You may have to work out something with dummy units to do the actual attacking for the towers.
04-08-2010, 01:52 PM#3
MasterofSickness
Thanks for the hints earth-fury!

And what is with the animation names "left" and "right"? (Reference)
Where are they used? If they work for attack, then I would prefer this for 2 directions!
In the mdl file under sequences I tried Anim "attack left" and "attack right", but the later mdx only attacks with "attack left".
Are they used for stand left or walk left or for what?
Does there exist a tutorial about the uses of the animation names (I think no, used the search function a lot)?
04-08-2010, 03:50 PM#4
Ammorth
I believe they are modifiers for hands "hand, left".