Jump to content
  • 0

binding an animetion to char


Sweets

Question

hey friends I used a helper code as a projectile and I wanted to add an animation to the enemy char when it gets hurt by the projectile. I wanted the animation to stick on the enemy even if he gets pushed back or falls. How could I code something like this.

 

heres what I got so far.

 

my char animation

[statedef 220]

type = a

movetype= a

physics = n

ctrl = 0

anim = 220

sprpriority = 1

 

[State 500, 1]

type = Helper

trigger1 =animelem= 14

stateno = 229

pos = 10,-28

postype = p1

ownpal = 1

supermovetime = 0

pausemovetime = 0

 

 

[state 220, 2]

type = playsnd

trigger1 = time = 2

value = 0,4

 

[state 220, 3]

type = changestate

trigger1 = animtime = 0

value = 0

ctrl = 1

 

;---------------------------------------------------------------------------

;my actual  helper

[statedef 229]

type = a

movetype= A

physics = n

ctrl = 0

anim = 230 ;this is the projectile animetion

sprpriority = 2

velset = 1.8,-.08

 

[State hitdef]

type = HitDef

trigger1 = time=0

attr = S, NP

hitflag = maf

animtype = Medium

damage = 30,0

guardflag = MA

pausetime = 1,15

sparkno = s1

hitsound = s5,2

guardsound = s6,0

ground.type = high

ground.slidetime = 15

ground.hittime = 15

ground.velocity = -2.7,-3

air.velocity = -4,3

 

[State 229, 3]

type = ChangeState

trigger1 = movecontact

trigger2 = vel y > 0

trigger2 = pos y > -vel y

value = 223

 

;-------------------------------------------------

;my exploding animation

[statedef 223]

type = A

movetype= A

physics = n

anim =300

ctrl = 0

sprpriority = 2

velset = 0,0

 

 

[state safe pos ground]

type = posset

trigger1 = !time

trigger1 = pos y > 0

y = 0

[State end]

type = DestroySelf

trigger1 = !animtime

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

you can use a bindtotarget code or a posset code.

[State 0, BindToTarget]
type = BindToTarget
trigger1 = !time
time = 99
ID = -1
pos = 0,0,Mid

or


[State 0, PosSet]
type = PosSet
trigger1 = 1
x = target,pos x
y = 0

 

Link to comment
Share on other sites

  • 0

haha well ill be dammed it worked you are a genius.

I added the bindtotarget on the exploding state

and it works like a miracle.

how could I get the target to move back because the

ground.velocity doest effect him anymore.

 

Link to comment
Share on other sites

  • 0

srry but I guess it didn't work. I wanted the animation to be on top of the target even if the target walks or jumps or flys away you know  binding it no matter what.

 

10 hours ago, Ryon said:

you can use a bindtotarget code or a posset code.


[State 0, BindToTarget]
type = BindToTarget
trigger1 = !time
time = 99
ID = -1
pos = 0,0,Mid

or


[State 0, PosSet]
type = PosSet
trigger1 = 1
x = target,pos x
y = 0

 

 

Link to comment
Share on other sites

  • 0

if you want it on top the best way to go about it is this.

 

bind to target the helper

and use explods that explod on p1 (when the explod is in the helper state p1 is the helper)

so they will constantly spawn on the helper, who is bound to the target.

Link to comment
Share on other sites

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
×
×
  • Create New...