Having difficulty finding Diagonal movement scripts for 4.5

zeldafreakneo

New member
Can someone please point me in the right direction?

I'm not looking for anything fancy like adding diagonal movement sprites, I would just like more intuitive and fluid movement for the character.

I see a few scripts for 4.1 but will those work in 4.5/4.6?
 

WillElm

New member
zeldafreakneo said:
Can someone please point me in the right direction?

I'm not looking for anything fancy like adding diagonal movement sprites, I would just like more intuitive and fluid movement for the character.

I see a few scripts for 4.1 but will those work in 4.5/4.6?

There's gotta be a way, but it's not gonna be as easy for whatever reason. The arguments #LEFT_UP and #UP_LEFT gives me an error, which i think means the StartMoving macro can't do it. and i haven't been able to make a diagonal monster AI by flagging the right bits. It doesn't bode well that the AI scripts have the comment "Choose out of 4 directions, UDLR." I'm looking at oStartMovingInADirection, which you see the JSR for in the StartMoving macro, but I don't really know what to make of it. I wonder where the arguments are defined...
 

WillElm

New member
zeldafreakneo said:
Thank you for looking into this. Hopefully a solution can be found soon.

I'm pretty lost tbh. I have a few threads on things that are different in the scripts/engine. I really like so many of the features of 4.5.6 but there are so many basic changes that make small modifications completely different. I'm sure many of these things will be solved in time though.
 

Doktor.E

New member
Maybe this is what you're looking for? It works for me.

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

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

    RTS

I just modified the tutorial movement scripts to say #DOWNLEFT instead of just #DOWN or #LEFT. I made these for each of the 4 additional directions to make it an 8 direction game. Then I just assigned them with the input editor as you would a 4 direction game. So for Down/Left, you would choose those two directions and select "Hold". If you're looking for strictly diagonal movement like in Q*Bert for example, I imagine you would just use this way and exclude left, right, up, and down.

I'm still in the tutorial phase, so this probably isn't the best way to do it or whatever. Also collisions are a lil ugly because I'm still using the tutorial script for solid objects where you simply stop moving upon collision.

Hope this helps!
 

WillElm

New member
Doktor.E said:
Maybe this is what you're looking for? It works for me.

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

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

    RTS

I just modified the tutorial movement scripts to say #DOWNLEFT instead of just #DOWN or #LEFT. I made these for each of the 4 additional directions to make it an 8 direction game. Then I just assigned them with the input editor as you would a 4 direction game. So for Down/Left, you would choose those two directions and select "Hold". If you're looking for strictly diagonal movement like in Q*Bert for example, I imagine you would just use this way and exclude left, right, up, and down.

I'm still in the tutorial phase, so this probably isn't the best way to do it or whatever. Also collisions are a lil ugly because I'm still using the tutorial script for solid objects where you simply stop moving upon collision.

Hope this helps!

No that's likely the way to do it. For whatever reason, I couldn't get diagonal ai to work. I'm in platformer though, so it might be like 4.1.5 where you have to do a modification to get vertical movement to work.
 

Doktor.E

New member
WillElm said:
Doktor.E said:
Maybe this is what you're looking for? It works for me.

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

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

    RTS

I just modified the tutorial movement scripts to say #DOWNLEFT instead of just #DOWN or #LEFT. I made these for each of the 4 additional directions to make it an 8 direction game. Then I just assigned them with the input editor as you would a 4 direction game. So for Down/Left, you would choose those two directions and select "Hold". If you're looking for strictly diagonal movement like in Q*Bert for example, I imagine you would just use this way and exclude left, right, up, and down.

I'm still in the tutorial phase, so this probably isn't the best way to do it or whatever. Also collisions are a lil ugly because I'm still using the tutorial script for solid objects where you simply stop moving upon collision.

Hope this helps!

No that's likely the way to do it. For whatever reason, I couldn't get diagonal ai to work. I'm in platformer though, so it might be like 4.1.5 where you have to do a modification to get vertical movement to work.



It feels pretty solid. I'm trying to figure out a way to adjust speed for diagonal movement now. It sorta adds the Up/Down and Left/Right speed together when you go diagonally.
 
Top Bottom