4.5.9 Maze/adventure Dash button working (resolved but open topic)

kevintron

Active member
Ive been digging through the older help threads looking for tips and general understanding. I came accost this Dash Issues thread which works out getting a dash button working for the Maze/adventure module. I mostly understand it and messed around until I got something working. I made 4 dash input scripts one for each direction. Hold B and right direction run right dash script. do one for each direction. then I also put change moving to stop on B release. This Boost in what ever direction is held as long as b is held. I understand what part of the code to change to increase the speed so that's all good. Now the weird thing is as long as I Hold a direction and B I boost and can change direction if I roll my finger on the d-pad. Including diagonal which is something that does not work in my game(which for this project I prefer). The other weird thing if I hit right and down together it moves diagonal the opposite way down and left. Every other diagonal works fine. I was wondering if anyone knows why that might be. I guess I want all the diagonals to work or none of them. I will include the code below. The last thing I was wondering is can I put a timer and a cool down on the boost so the player cant boost endlessly? I'm still pretty novice but kinda proud that I got it working this far. This is the last feature my game needs. One note my input also has extra code at the top to disable button inputs during text, that is currently working. Here is a link to fix text issues.

Code:
;;;; dash Left
LDA is_drawing_box ;; Check if box is still drawing pigeonaut fix
CMP #$00
BEQ +do_player_input ;;no longer drawing so we can do player input again!
    JMP skip_player_inputm ;; is_drawing_box is still a 1 so that must mean the text is still drawing. Better skip player input to avoid freezing the game!
+do_player_input
;; player input stuff 
    TXA
    STA temp ;; assumes the object we want to move is in x.
 GetActionStep temp
    CMP #$07
    BNE +notHurt
        RTS
    +notHurt
        
    ;;dash Left  AllDarnDavey Object_direction variable
    LDA #%00000110
    STA Object_direction,x
    LDA #$04
    STA Object_h_speed_hi,x



    skip_player_inputm
    RTS
  
;;;; dash Up
LDA is_drawing_box ;; Check if box is still drawing pigeonaut fix
CMP #$00
BEQ +do_player_input ;;no longer drawing so we can do player input again!
    JMP skip_player_inputo ;; is_drawing_box is still a 1 so that must mean the text is still drawing. Better skip player input to avoid freezing the game!
+do_player_input
;; player input stuff 
    TXA
    STA temp ;; assumes the object we want to move is in x.
 GetActionStep temp
    CMP #$07
    BNE +notHurt
        RTS
    +notHurt
        
    :;dash Up AllDarnDavey Object_direction variable
    LDA #%00000100
    STA Object_direction,x
    LDA #$04
    STA Object_v_speed_hi,x



    skip_player_inputo
    RTS
  
    ;;;; dash Right
LDA is_drawing_box ;; Check if box is still drawing pigeonaut fix
CMP #$00
BEQ +do_player_input ;;no longer drawing so we can do player input again!
    JMP skip_player_inputn ;; is_drawing_box is still a 1 so that must mean the text is still drawing. Better skip player input to avoid freezing the game!
+do_player_input
;; player input stuff 
    TXA
    STA temp ;; assumes the object we want to move is in x.
 GetActionStep temp
    CMP #$07
    BNE +notHurt
        RTS
    +notHurt
        
        ;;dash Right AllDarnDavey Object_direction variable
    LDA #%01000010
    STA Object_direction,x
    LDA #$04
    STA Object_h_speed_hi,x



    skip_player_inputn
    RTS 
  
    ;;;; dash Down
LDA is_drawing_box ;; Check if box is still drawing pigeonaut fix
CMP #$00
BEQ +do_player_input ;;no longer drawing so we can do player input again!
    JMP skip_player_inputp ;; is_drawing_box is still a 1 so that must mean the text is still drawing. Better skip player input to avoid freezing the game!
+do_player_input
;; player input stuff 
    TXA
    STA temp ;; assumes the object we want to move is in x.
 GetActionStep temp
    CMP #$07
    BNE +notHurt
        RTS
    +notHurt
        
    ;;dash Down AllDarnDavey Object_direction variable
    LDA #%00010000
    STA Object_direction,x
    LDA #$04
    STA Object_v_speed_hi,x



    skip_player_inputp
    RTS
 
Last edited:

kevintron

Active member
After playing around with inputs I realized I was gonna have to change something so I added 8-way directional movement mentioned here. This worked. The only thing being the boost doesn't work on the diagonal only on the horizontal or vertical. This makes sense since I never added the boost diagonal. If you are interested in making diagonal boost inputs I found the movement arguments noted here. I assume but have not tested that if you make an additional boost for each diagonal this method will work in all 8 directions. Using those arguments It should work like this.

Code:
    ;;;;;each direction you want to dash needs its own asm file, then its own input assigned you must use a non directional button for boost.
    ;;;;;;;;;You must have 8 way movement setup first


        ;;dash Down this should be assigned to input main game state "Hold" "Down" and "B" (assumes B is boost)
    LDA #%00010000
    STA Object_direction,x
    LDA #$04   ;;adjust speed change value use hex  ( 04 is fast  0A is crazy fast)
    STA Object_v_speed_hi,x
   
::Each direction you want to dash needs its own individual asm file. then its own input assigned this is the next one

        ;;dash Down Right this should be assigned to input main game state "Hold" "Down" and "Right" and "B" (assumes B is boost)
    LDA  #%11110000
    STA Object_direction,x
    LDA #$04  ;;adjust speed change value use hex( 04 is fast 0A is crazy fast)
    STA Object_v_speed_hi,x

Since I did not add the diagonal boost just diagonal movement my player drops out of boost if the input changes to diagonal. The player still moves in the correct direction. If the input changes to a single direction the boost reactivates if the boost button remains held. This mechanic works nicely for my game. I shared what I learned so this can hopefully be customized for other projects. Im using this in the Maze module but this should also work in the Adventure module.
 
Top Bottom