Rotate the player by 90 degrees by pressing left or right buttons

abenjack

New member
Hello everyone!
I would like my player rotate by 90 degrees with a small animation when I press a button (clockwise by pressing right button, counterclockwise with left button).
Is it possible with a script?

Thanks in advance
 

dale_coop

Moderator
Staff member
I think to turn clockwise the script would look something like:
Code:
    ;; clockwise
    LDA Object_direction,x
    AND #%00000111
    SEC
    SBC #$02
    AND #%00000111
    TAY
    LDA DirectionTableOrdered,y
    ORA FacingTableOrdered,y
    STA Object_direction,x

And for counter clockwise:
Code:
    ;; counter clockwise
    LDA Object_direction,x
    AND #%00000111
    CLC
    ADC #$02
    AND #%00000111
    TAY
    LDA DirectionTableOrdered,y
    ORA FacingTableOrdered,y
    STA Object_direction,x
 

Peter Schmitz

Active member
isn't it just possible to make a left and right animation when pressing left or right, in which the sprite gets flipped? Then continue with an moving animation for left and right while holding the buttons.
 

abenjack

New member
Hi Dale, Peter,
nothing to do. If I try the snippet of code suggested by Dale, something goes wrong (or mybe I did some mistake). I got the snippet, put it on a .asm file and associate it to the input when I press the right button (for clockwise). Is it correct?
 
Top Bottom