The Dink Network

Re: Force enemy to run seq

February 14th 2014, 02:45 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Is there a way to get a static enemy sprite to run an animation on repeat?
It works fine if I change it to a reapeat brain.. but I want it to be "killable" by hitting it.

I guess I could write a hit procedure and just kill it manually when sp_hitpoints() reaches zero.. but that's not as fun
February 14th 2014, 03:06 PM
wizardg.gif
Repeat brains don't die even if they have hitpoints set. They're just not meant to. If a repeat brain has hitpoints it'll bleed when its hit, but it'll never die because it doesn't take damage.

You might be able to kill it through hit() with sp_kill() but I'm not sure if that works with brain 6 as I've never done that.
February 14th 2014, 03:20 PM
eye.gif
synbi
Peasant He/Him Finland
 
The next logical thing to try might be to make the sprite with a normal enemy brain/attributes, but also spawn another script which has a loop that updates the enemy's sprite constantly, simulating a repeat animation, something simple like:
loop:
sp_frame(&sprite,1)
wait(50);
sp_frame(&sprite,2);
wait(50);
...
goto loop;

I don't remember what the difference between sp_pframe and sp_frame actually was again... just use the one that works
February 14th 2014, 03:39 PM
wizardg.gif
sp_pframe() changes the frame that's currently seen, and sp_frame() determines the next frame to play when animating.

I guess you could force animate by looping sp_pframe() but it doesn't seem necessary to have another sprite run that script.

I'd just run something in the hit().
February 14th 2014, 04:30 PM
custom_coco.gif
Cocomonkey
Bard He/Him United States
Please Cindy, say the whole name each time. 
Well, in Malachi the Jerk I had a boss with a brain 6 phase.

What I did (thanks to thenewguy) was to actually have two sprites: the one you see with the repeating animation, and an invisible one at the same location that has brain 9 so it can take damage.
February 14th 2014, 10:09 PM
goblins.gif
That boss was really cool by the way.