Re: Force enemy to run seq
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
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

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.
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.
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:
I don't remember what the difference between sp_pframe and sp_frame actually was again... just use the one that works
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

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().
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().
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.
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.