Spawnbind Animations Not Entities

danno

Moderator
Staff member
I'll explain the logic with entities first.

I'm using OpenBor Enigine 4

Steve 1

anim walk
loop 1 1 4 ( loops after frame 0 so spawn doesn't loop )
delay 1
offset 27 69
bbox 21 12 12 60
@cmd spawnbind "Steve2" 0 0 2 1 5
frame Data/chars/steve/w1.png
delay 7
frame Data/chars/steve/w1.png
frame Data/chars/steve/w2.png
frame Data/chars/steve/w3.png
frame Data/chars/steve/w4.png

This is Steve 1 anim walk

SGWOfPB.gif


This is Steve 2 anim walk

o5ej35o.gif


animation changes to idle when key forward or backward is released and Steve 2 unbinds because Steve 2 has no idle animation

This is Steve 1 anim idle

2mIguyX.png


I want to do this with animations only in Steve 1 but I can't wrap my head around it simply without over complicating it, key changes within a single animation


so for example walking

idle walk

SGWOfPB.gif


while walking base instead of Steve 2 its Freespecial5

o5ej35o.gif

SGWOfPB.gif


while walking attack is pressed, Freespecial6

A6ay1qk.gif

SGWOfPB.gif


attack animation is finished, back to base while still walking

o5ej35o.gif

SGWOfPB.gif


diagonal up attack while walking, Freespecial7

RZ4EMuK.gif

SGWOfPB.gif


diagonal up attack animation is finished, back to base while still walking

o5ej35o.gif

SGWOfPB.gif


diagonal down attack while walking, Freespecial8

xLzUijc.gif

SGWOfPB.gif


and so on

while walking different animations play depending on keypress and release. It's beyond me trying to script it all out so any help to simplify it would be appreciated.

Just to clarify I already am using multiple entities to do this, I was just wondering how it could be done that one entity could display two separate animations at the same time. Overlayed,
 
Last edited:
I'll explain the logic with entities first.

I'm using OpenBor Enigine 4

Steve 1

anim walk
loop 1 1 4 ( loops after frame 0 so spawn doesn't loop )
delay 1
offset 27 69
bbox 21 12 12 60
@cmd spawnbind "Steve2" 0 0 2 1 5
frame Data/chars/steve/w1.png
delay 7
frame Data/chars/steve/w1.png
frame Data/chars/steve/w2.png
frame Data/chars/steve/w3.png
frame Data/chars/steve/w4.png

This is Steve 1 anim walk

SGWOfPB.gif


This is Steve 2 anim walk

o5ej35o.gif


animation changes to idle when key forward or backward is released and Steve 2 unbinds because Steve 2 has no idle animation

This is Steve 1 anim idle

2mIguyX.png


I want to do this with animations only in Steve 1 but I can't wrap my head around it simply without over complicating it, key changes within a single animation


so for example walking

idle walk

SGWOfPB.gif


while walking base instead of Steve 2 its Freespecial5

o5ej35o.gif

SGWOfPB.gif


while walking attack is pressed, Freespecial6

A6ay1qk.gif

SGWOfPB.gif


attack animation is finished, back to base while still walking

o5ej35o.gif

SGWOfPB.gif


diagonal up attack while walking, Freespecial7

RZ4EMuK.gif

SGWOfPB.gif


diagonal up attack animation is finished, back to base while still walking

o5ej35o.gif

SGWOfPB.gif


diagonal down attack while walking, Freespecial8

xLzUijc.gif

SGWOfPB.gif


and so on

while walking different animations play depending on keypress and release. It's beyond me trying to script it all out so any help to simplify it would be appreciated.

Just to clarify I already am using multiple entities to do this, I was just wondering how it could be done that one entity could display two separate animations at the same time. Overlayed,
That's a cool concept. If I understood correctly, basically both upper/lower parts are desynched and the upper part acts according to buttons pressed, right?
 
Yeah exactly, it's hard enough doing it with entities, I'm using 3 entities right now, one for the legs and two for killing and respawning the upper body, so as one upper body entity dies it's replaced by another, and I was thinking there has to be an easier way, then I thought about simply binding animations but I'm not sure if the engine works that way.

I doubt it but I'm not experienced enough to say otherwise.

It would be cool if one animation could display another animation at the same time like walking legs and attack is pressed and freesepicial is displayed above the legs without needing another entity.

But ideally two entities should be enough if I had better scripting knowledge, I'd be able to have two entities acting completely different from each other while giving the illusion of one entity.
 
But ideally two entities should be enough if I had better scripting knowledge, I'd be able to have two entities acting completely different from each other while giving the illusion of one entity.
I can do some tests, I believe that it's possible by using keyscripts. The concept I'm thinking is:

- the main player entity spawn a secondary entity inside the onspawn event, saving it in a variable.
- a keyscript called by the main player entity will get inputs and force animation changes on the secondary entity through the saved variable.
- a script that runs constantly like think.c (or ondraw/update, but think.c is less costly to the engine) to detect some situations and make the secondary entity react accordingly.

Is this correct?
 
Correct, I think this way will make animations look even smoother and will also allow the upper body of the entity to be independent from the lower body.
 
That looks really good @Kratus, did you use think script?
After some tests I saw that the update script is better due to working faster, here's the game file I used in the video.
Basically it's a conjunction of the update+keyscript, there's many things to improve but the main concept is working.

That looks similar to what I've made for my recent games (Raiders Rush, Steampunk Raiders and Barshen Blizzard). The main entity player is playing is just the torso + legs while the head and arm are two seperate entities controlled via the former.
Cool :) I didn't saw these games before. Great job, buddy!
 
Hey guys, I'm late to the party and looks like you got the code down. One thing I would warn about - sprite stacking doesn't tend to play nice with gfx shadows due to the engine optimizing sprites and differing calculation results between the pieces.

You'll sometimes see a pixel wide overlap or offset gap in the shadows of your stacked entity.

DC
 
Back
Top Bottom