[4.5] Can't move player UpRight/UpLeft

m8si

New member
This should be simple but I am not able to figure out what is wrong.

The first time script works fine. When I press UpRight/UpLeft the player moves correctly. But after I press DownRight/DownLeft player keeps moving DownRight/DownLeft even though I press UpRight/UpLeft.

Code:
  TXA
    STA temp ;; assumes the object we want to move is in x.

    StartMoving temp, #UPRIGHT
     
 
    RTS

Code:
 TXA
    STA temp ;; assumes the object we want to move is in x.

    StartMoving temp, #DOWNRIGHT
      

    RTS

etc...
 

m8si

New member
I can't post screenshot right now. I have those scripts attached to up and down presses. On hold button. I even tested it on fresh version of nesmaker to make sure I haven't broke any scripts.

On fresh install I made new project using 4.5 template that comes with it. Then I made a playerobject and just added those scripts to input scripts and attached them to keypresses. Did I miss something?
 

dale_coop

Moderator
Staff member
No, it should be correct... but sometimes, small mistakes in the input editor.
If it's just that, I can check quickly...
 

dale_coop

Moderator
Staff member
Here's my UPRIGHT:

Code:
    TXA
    STA temp ;; assumes the object we want to move is in x.

        StartMoving temp, #UPRIGHT
        TXA
        STA temp ;; assumes the object we want to move is in x.
        ChangeFacingDirection temp, #FACE_UPRIGHT

    RTS
 

m8si

New member
Is changeFacingDirection required? I cut it out because there is no need to change animation ay my case. But maybe it affects to movement also. I have to test it later
 

dale_coop

Moderator
Staff member
Yeah. All my diagonal movements work fine.
Could you share a screenshot of your Input Editor? I can check that the issue is not from here.
 

dale_coop

Moderator
Staff member
After some tests with your configuration... I can reproduce the issue.
Your project is very particular because you don't move just left / right / up / down.... so, some variables are not set back correctly.


For the use of YOUR project, you could try this:

1) Duplicate the "oStartMovingInADirection.asm" script (located in your "Routines\BASE_4_5\System\ObjectBehaviors" folder) as "oStartMovingInADirection_Diags.asm", for example...

2) Modify that "oStartMovingInADirection_Diags.asm", line 8, adding:
Code:
		STA Object_direction,x
Like this:


3) Then, in your "Project Settings > Script Settings", select the "Start Moving" under "Behaviors" and assign the "oStartMovingInADirection_Diags.asm" to it:


Now, I think your diagonal movements should work better, in your case.
 
Top Bottom