Doing a trampoline in scrolling platformer

User avatar
dale_coop
Posts: 4597
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Doing a trampoline in scrolling platformer

Post by dale_coop » Sat Jan 11, 2020 9:05 pm

With that script? interesting... I'll check later...
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
dale_coop
Posts: 4597
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Doing a trampoline in scrolling platformer

Post by dale_coop » Sat Jan 11, 2020 9:15 pm

I tested the script... I just changed the:

Code: Select all

	ADC #$0E ;; <-- HERE: however far you want to check beneath the player
To something smaller, I think for that module 04 would be enough...

Code: Select all

	ADC #$04 ;; <-- HERE: however far you want to check beneath the player
And seems like it works well, for player 1 and player 2.

Image
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
TolerantX
Posts: 37
Joined: Fri Jan 18, 2019 7:58 am

Re: Doing a trampoline in scrolling platformer

Post by TolerantX » Tue Jan 14, 2020 5:53 pm

This is my current jump input code.... the player 2 currently still falls through.


Code: Select all

    ;; checking the current state of the player:
    GetCurrentActionType player1_object
    CMP #$07	;; if in "invisible" state
    BNE +
    ;; skip the script:
    RTS
    +
    
    ;; from here the rest of the script:

; load the playerX_object (current inputs):
JSR PlayerXobjectInputs

goJump:
    ;; if on a cutscene:
    LDA screenFlags
    AND #%00000010
    BEQ +
    RTS
    +
    LDA isPaused
    BEQ +
    RTS
    +

    ; a jumps
 
   ;LDX player1_object
   ;;; let's check for if we are standing on a jumpthrough platform,
   ;;; for which "down and jump" will jump downwards through
   ;;; comment this out if you do not want that functionality
    LDA screenFlags
    AND #%00100000 ;; does it use gravity?
    BNE usingGravity
    JMP dontJump
usingGravity:
   LDA Object_physics_byte,x
   AND #%00001000
   BEQ notStandingOnJumpThroughPlatform

   CPX player2_object
   BNE +
   LDA gamepad2
   AND #%00100000   ;; pressing Down?
   BEQ notStandingOnJumpThroughPlatform
   JMP ++
   +
   LDA gamepad
   AND #%00100000   ;; pressing Down?
   BEQ notStandingOnJumpThroughPlatform
   ++

   LDA Object_y_hi,x
   CLC
   ADC #$09
   STA Object_y_hi,x
   JMP dontJump
notStandingOnJumpThroughPlatform:
   
   LDA Object_physics_byte,x
   AND #%00000001
   BNE canJump
   LDA Object_physics_byte,x
   AND #%00000100   ;; solid under player's feet ?
   BNE canJump
   JMP dontJump
   
   
   ;; jump on walls
    ; LDA collisionPoint2 
    ; ORA collisionPoint3
    ; AND #%10000000
    ; BNE canJump
    ; LDA collisionPoint1
    ; ORA collisionPoint4
    ; AND #%10000000
    ; BNE canJump

   ;;JMP dontJump
    
canJump:
    ;PlaySound #SND_JUMP
canJumpAgain:
    ;;; TURN OFF "STANDING ON JUMPTHROUGH PLATFORM" if it is on
    LDA Object_physics_byte,x
    AND #%11110111
    STA Object_physics_byte,x
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    LDA #$00
    SEC
    SBC #JUMP_SPEED_LO
    STA Object_v_speed_lo,x
    LDA #$00
    SEC
    SBC #JUMP_SPEED_HI
    STA Object_v_speed_hi,x
    CPX player1_object
    BEQ +
        GetCurrentActionType player2_object
        JMP ++
    +
        GetCurrentActionType player1_object
    ++
    CMP #$03 ;; attack
    BEQ +
    ChangeObjectState #$02, #$04
    +
    ;PlaySound #SND_JUMP
dontJump:
;; check if on trampoline:
    LDA Object_x_hi,x
    CLC
    ADC Object_left,x
    STA tileX
    LDA Object_y_hi,x
    CLC
    ADC Object_bottom,x
    CLC
    ADC #$04 ;; <-- HERE: however far you want to check beneath the player
    STA tileY
    JSR GetTileAtPosition
    LDA collisionTable,y
    CLC
    CMP #COL_TRAMPOLINE ;; the bounce tile type
    BEQ JumpingOnTrampoline
    JMP notJumpingOnTrampolineTile
JumpingOnTrampoline:
    ChangeObjectState #$02, #$02
    LDA #$00
    SEC
    SBC #$08    ;; <-- HERE, the TRAMPOLINE JUMP value
    STA Object_v_speed_hi,x
notJumpingOnTrampolineTile:
    RTS
User avatar
dale_coop
Posts: 4597
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Doing a trampoline in scrolling platformer

Post by dale_coop » Tue Jan 14, 2020 9:19 pm

The 7 lines at the beginning of your script should not be here.
Those are not compatible with the 2 player module.

Try without those lines.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
Post Reply