Hold Block - Face Different Direction

tightninja

Member
Is there any way to face a different direction while holding the block button? IF I am facing right, can I press back (left) to face left?

I tired drawmethod flipx 1 below . It does flip the frame to face left, but the engine has determined that I am still facing right.



#####-----STANDARD BLOCK
anim block

loop 0
delay 6
offset 80 129
bbox 68 83 24 44

cancel 0 2 0 u a4 freespecial111 #movelist
cancel 0 2 0 d freespecial200 #DUCK
cancel 0 2 0 f f freespecial100 #FWD DODGE
cancel 0 2 0 b b freespecial99 #BACK DODGE
cancel 0 2 0 u u freespecial190 #UP DODGE
cancel 0 2 0 d d freespecial189 #DOWN DODGE
cancel 0 2 0 a freespecial5 #FIERCE KICK
cancel 0 2 0 a2 freespecial66 #SKATE BREAKIN
cancel 0 2 0 j freespecial60 #FORWARD LEAP
cancel 0 2 0 b freespecial186 #DIRECTIONAL BLOCK
cancel 0 2 0 b freespecial186 #DIRECTIONAL BLOCK
cancel 0 2 0 d f d f a4 freespecial88 #CVS ISM SUPER ART I
cancel 0 2 0 d f d f a3 freespecial89 #CVS ISM SUPER ART II

frame data/chars/1sonny/b104.gif

frame data/chars/1sonny/block.gif


#####----- DIRECTIONAL BLOCK
anim freespecial186
loop 0
delay 6
offset 80 129
bbox.position.x 68
bbox.position.y 83
bbox.size.x 24
bbox.size.y 44


drawmethod flipx 1


cancel 0 2 0 d freespecial200 #DUCK
cancel 0 2 0 f f freespecial100 #FWD DODGE
cancel 0 2 0 b b freespecial99 #BACK DODGE
cancel 0 2 0 u u freespecial190 #UP DODGE
cancel 0 2 0 d d freespecial189 #DOWN DODGE
cancel 0 2 0 a freespecial5 #FIERCE KICK
cancel 0 2 0 a2 freespecial66 #SKATE BREAKIN
cancel 0 2 0 j freespecial60 #FORWARD LEAP
cancel 0 2 0 d f d f a4 freespecial88 #CVS ISM SUPER ART I
cancel 0 2 0 d f d f a3 freespecial89 #CVS ISM SUPER ART II

frame data/chars/1sonny/b104.gif
delay 45
frame data/chars/1sonny/block.gif
 
Try animationscript KeyFlip



C-like:
void keyflip()
{// Change hero's facing direction if left or right is pressed
    void self = getlocalvar("self");
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index

    if (playerkeys(iPIndex, 0, "moveleft")){ // Left is pressed?
      changeentityproperty(self, "direction", 0); //Face left
    } else if (playerkeys(iPIndex, 0, "moveright")){ // Right is pressed?
      changeentityproperty(self, "direction", 1); //Face right
    }
}


anim jump
loop 1
delay 1
offset 53 94
bbox 37 31 11 50
@cmd keyflip
frame data/chars/police/jo1.png
@cmd keyflip
frame data/chars/police/jo1.png
 
Last edited:
You should use anim block instead of a freespeacial then you won't have the idle problem and use holdblock too

C:
holdblock   1

   
   
   
   
anim block
    loop    1
    delay    10
    offset    64 135
    bbox    54 57 30 77
    @cmd    keyflip
    frame    data/chars/rick/bl1.png
    @cmd    keyflip
    frame    data/chars/rick/bl1.png

EDIT: I see from previous posts you're not creating your own project but editing @Mr.Q! Double dragon, there's many moving parts and you'll have to customise your own block system as Mr Q did, I'm not sure how he did it so you're better off asking the original author.
 
Last edited:
Yeah his game was great. I just wanted to change a couple of things. I have reached out to him, but he has been busy working on fight forever.

This is my first time modding and programming, it's been fun and frustrating at the same time. I appreciate everyone's help. Invaluable advice.

EDIT

All of my blocks and duck are working now (needed key flip and looping). Thanks again! I am sure I have more questions. I never thought this would be just as fun as playing the games lol. I am 200 hours on this mod since early July, roughly 8-12 hours per week at this point.
 
Last edited:
Glad to hear you solved your block issue. Though I should tell you that if you set loop to 1, your custom block will loop even if you're not holding block button. If that's what you want, okay then. But if you need to create custom block animation with scripted looping, you need function such as keyint to loop by holding certain key.
 
Glad to hear you solved your block issue. Though I should tell you that if you set loop to 1, your custom block will loop even if you're not holding block button. If that's what you want, okay then. But if you need to create custom block animation with scripted looping, you need function such as keyint to loop by holding certain key.


Yes you are correct i woul prefer to hold the button. However, it isn't a deal breaker and especially with the DUCK freespecial. I wish we could cancel into "anim block" or "anim attack1" Is it posible to right a script to do that?
 
I wish we could cancel into "anim block" or "anim attack1" Is it posible to right a script to do that?

Changing animation is easy but it requires change state also. For attacking, you need to disable idle state if you change from IDLE animation. If you change from other attack animation, there's no need to do this.
For blocking, you need to activate blocking state with script. Here's an example for custom block animation:
Code:
anim    freespecial
    delay    4
    offset    32 61
    @cmd    block 1
    bbox    22 7 17 54
    frame    data/chars/marth/block.png
    frame    data/chars/marth/block.png
    @cmd    keyflip 0
    @cmd    keyint "ANI_FREESPECIAL" 1 "A2" 0
    frame    data/chars/marth/block.png
    @cmd    block 0
    frame    data/chars/marth/block.png

block function activates blocking state while keyint changes animation if defined key is held. Since the defined animation is the same as current animation, keyint basically loops this animation if attack2 key is held.
 
Changing animation is easy but it requires change state also. For attacking, you need to disable idle state if you change from IDLE animation. If you change from other attack animation, there's no need to do this.
For blocking, you need to activate blocking state with script. Here's an example for custom block animation:
Code:
anim    freespecial
    delay    4
    offset    32 61
    @cmd    block 1
    bbox    22 7 17 54
    frame    data/chars/marth/block.png
    frame    data/chars/marth/block.png
    @cmd    keyflip 0
    @cmd    keyint "ANI_FREESPECIAL" 1 "A2" 0
    frame    data/chars/marth/block.png
    @cmd    block 0
    frame    data/chars/marth/block.png

block function activates blocking state while keyint changes animation if defined key is held. Since the defined animation is the same as current animation, keyint basically loops this animation if attack2 key is held.
i get an error when I try to use @cmd block 1 as block is not found or understood. Currently using 4.0 7555
 
Tip: whenever you see "@cmd", it is calling a function and with exception of few native functions - like "projectile" - or inline shortcuts like "@cmd killentity getlocalvar("self")", you will need that function in your animationscript file.
 
exception of few native functions

Just to clarify - it's actually any native script function. @cmd is almost always used to call user defined functions, but it doesn't actually care. All that matters is the called function being available in scope, which for @cmd means anything defined or made available in the model's animation script. Native script functions are available to all scripts at all times, so they are in turn always valid to call with @cmd.

Furthermore, any macros available in animation scripts are also valid, and is something that can (and should) be leveraged for readability and consistency (See "Avoiding Magic Numbers"):


DC
 
Back
Top Bottom