platformer codes ?

digit2600

Member
does anybody have any gravity and or jumping scripts by any chance? my project is at a slight stand still at the moment until I can at least implement jumping and gravity..
 

dale_coop

Moderator
Staff member
As I heard, the plateform module is scheduled for Aug 22nd... (scripts, with a tutorial video)

But if you can't wait... or if you just want to play and experiment :)

I think if, you assign your "Project Details" scripts to the "plateform_Simple" ones... You will have the gravity working.
And for the "jump", there is some old scripts from the beta..

The "A_Jumps.asm" script:
Code:
    LDX player1_object
    
    ;;; get to bank with lut tables 
    ;; so we can read bottom of player
    LDA onGround
    BEQ cantJump
    ;;; if you want a *double jump*, need a variable
    ;;; that keeps track if we've jumped once as well.
    ;;; if we've already done a double jump, skips passed this too.
    ;;; on ground is factored in AccAndSpeed_Platform_Simple.
    ;;; you could also check to see if the player is hurt, if you dont
    ;;; want the player able to jump if he's hurt.
    ChangeObjectState #$02, #$02
    LDA #$00
    SEC
    SBC #$6
    STA Object_v_speed_hi,x
cantJump:  
    LDA Object_x_hi,x
    STA tileX
    LDA Object_y_hi,x
    CLC
    ADC #$18 ;; the height of the player + however far you want to check beneath the player
    STA tileY
    JSR GetTileAtPosition
    LDA collisionTable,y
    CMP #$09 ;; the bounce tile type
    BEQ JumpingOnTrampoline
    LDA tileX
    CLC
    ADC #$10 ;; object width
    STA tileX
    JSR GetTileAtPosition
    LDA collisionTable,y
    CMP #$09
    BEQ JumpingOnTrampoline
    JMP notJumpingOnTrampolineTile
    
JumpingOnTrampoline:
    ChangeObjectState #$02, #$02
    LDA #$00
    SEC
    SBC #$09
    STA Object_v_speed_hi,x
 notJumpingOnTrampolineTile:
    
    RTS

And the "A_release_var_jumping.asm" script:
Code:
    LDX player1_object
    LDA Object_v_speed_hi,x
    BPL isAlreadyMovingDown_noVarJump
    LDA #$Fe
    STA Object_v_speed_hi,x
isAlreadyMovingDown_noVarJump:
    RTS
 

dale_coop

Moderator
Staff member
In some days (Aug 22th) you will have the platform module with the tutorials...
I know 8 days is hard to wait, when playing with NESMaker ;)
 
Top Bottom