Solved Shake Effect when being hit

Question that is answered or resolved.

Okamijoe

Member
Hello,

here's a really basic question:
I have not found any dedicated function to make an enemy entity shake when being hit, so I'm wondering which method would be the best to tackle this issue.
As far as I know, there are two ways to do this:

1) Repositioning the sprite in it's graphics file directly, but you'll need to create some extra frames to make that work.

or

2) Changing the offset for each frame in an animation, like this:
anim pain
loop 0
delay 10
offset 81 177
bbox 58 81 39 96
sound data/sounds/hipain1.wav
delay 4
frame data/chars/orange/gethithigh1.png
offset 77 177
frame data/chars/orange/gethithigh1.png
offset 80 177
frame data/chars/orange/gethithigh1.png
offset 78 177
frame data/chars/orange/gethithigh1.png
offset 79 177
frame data/chars/orange/gethithigh1.png
delay 10
offset 81 177
frame data/chars/orange/gethithigh2.png
frame data/chars/orange/gethithigh3.png
I guess the offset method would be the better choice? Or is there something else?
Just to make sure that's the ideal way before applying it to all my entities.

Thank you!
 
Another +1 to offset shaking. This is the one and ONLY time I ever recommend using offset to simulate movement. Don't use this technique for anything else, there's always a much better way - ask us first. :)
 
Back
Top Bottom