This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-03-29 22:54:07

RetracO77
New Scratcher
Registered: 2013-03-29
Posts: 2

death animation

How would I make an enemy do a death animation and not just hide?

Offline

 

#2 2013-03-29 23:11:30

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: death animation

Well, if the enemy is dead, then start up a costume sequence (which is the death animation) THEN hide.

Hope this helped.


http://i46.tinypic.com/3148ksz.gif

Offline

 

#3 2013-03-30 02:15:34

shivadas
Scratcher
Registered: 2010-02-06
Posts: 100+

Re: death animation

The script would look something like this:

When I receive [Enemy Killed v]
switch to costume [Enemy Death 1 v]
wait [0.1] secs
switch to costume [Enemy Death 2 v]
wait [0.1] secs
switch to costume [Enemy Death 3 v]
wait [0.1] secs
hide
Hope that helps!

EDIT: That script would only work if you had another script broadcasting "Enemy Killed," so for now let's say an enemy dies when health < 10, and the script would look like this:

when gf clicked
forever if <[health] < [10]>
broadcast [Enemy Killed v]
end

Last edited by shivadas (2013-03-30 02:20:39)


Please check out my latest project, Hunger Avenger!

Offline

 

#4 2013-03-30 12:53:00

RetracO77
New Scratcher
Registered: 2013-03-29
Posts: 2

Re: death animation

shivadas wrote:

The script would look something like this:

When I receive [Enemy Killed v]
switch to costume [Enemy Death 1 v]
wait [0.1] secs
switch to costume [Enemy Death 2 v]
wait [0.1] secs
switch to costume [Enemy Death 3 v]
wait [0.1] secs
hide
Hope that helps!

EDIT: That script would only work if you had another script broadcasting "Enemy Killed," so for now let's say an enemy dies when health < 10, and the script would look like this:

when gf clicked
forever if <[health] < [10]>
broadcast [Enemy Killed v]
end

oh yeah, I forgot to mention the enemy was moving. how do i make it stop?

Offline

 

#5 2013-03-30 13:32:15

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: death animation

RetracO77 wrote:

shivadas wrote:

The script would look something like this:

When I receive [Enemy Killed v]
switch to costume [Enemy Death 1 v]
wait [0.1] secs
switch to costume [Enemy Death 2 v]
wait [0.1] secs
switch to costume [Enemy Death 3 v]
wait [0.1] secs
hide
Hope that helps!

EDIT: That script would only work if you had another script broadcasting "Enemy Killed," so for now let's say an enemy dies when health < 10, and the script would look like this:

when gf clicked
forever if <[health] < [10]>
broadcast [Enemy Killed v]
end

oh yeah, I forgot to mention the enemy was moving. how do i make it stop?

It will stop moving, that is, if your movement is controlled by a forever loop  wink


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

#6 2013-03-30 14:16:09

xlk
Scratcher
Registered: 2013-03-18
Posts: 57

Re: death animation

If the enemy moves:

when gf clicked
forever
 if <life > (0)>
  movement and stuff
 else
  death animation
  wait till respawn, or just hide it
  set [life] to [whatever amount of life it had]
 end
end
Can't get the "if...else..." block to work...

Offline

 

#7 2013-03-30 17:15:29

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: death animation

Another way:

forever
 if <touching [enemy v]?>
  repeat [10]
   change [ghost v] effect by [10]
   wait [0.01] secs
  end
 end


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

#8 2013-03-30 21:16:25

xlk
Scratcher
Registered: 2013-03-18
Posts: 57

Re: death animation

Stop with the "wait 0.01 secs" block, it is useles, it skips a frame anyway. even so, "wait 0 secs" also seems to skip a frame, so you're making it glitchy like that.

Offline

 

Board footer