wallmasterr
Active member
Cool, so there probably isn't an easy way then .
Is there an easy password system somewhere?
Is there an easy password system somewhere?
;;; maybe it's possible to ONLY do this if the ladders is underneath my feet
LDA #%00000010
STA tile_solidity
Thanks Daledale_coop said:Yep, ladder code is in the Physics script... and also some code in the Extra Controls Script.
ExtraInputControl:
;;; occasionally, there is input code that may be very specific, and it may be
;;; difficult to implement via the visual interface and accompanying scripts.
;;; this is a code that runs after all input checks, and allows for custom ASM.
LDA gameState
CMP #GS_MainGame
BEQ doMainGameUpdates
JMP skipMainGameExtraInputControl
doMainGameUpdates:
LDX player1_object
GetCurrentActionType player1_object
STA temp
LDA Object_physics_byte,x
AND #%00000010
BEQ isNotClimbing
LDA temp
CMP #$04
BNE isNotClimbing
LDA gamepad
AND #%11000000
BEQ noDirWhileClimbing
; ChangeObjectState #$02, #$04
noDirWhileClimbing:
;;; is climbing.
;;; which means don't check to change to idle.
; JMP skipMainGameExtraInputControl
isNotClimbing:
; LDA temp
; CMP #$03 ;; is it shooting (shooting is same anim in air and on ground )
; BNE isNotAttackingAction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CalculateAccAndSpeed:
LDA update_screen
BEQ doPhysics
RTS
doPhysics:
LDA gameHandler
AND #%10000000
BNE doPhysics2
RTS
doPhysics2:
CPX player1_object
BNE noAutoScroll
JSR handleAutoScroll
;JSR CheckAutoScrollLeftEdge
noAutoScroll:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA Object_vulnerability,x
AND #%00000001
BNE doAimedPhysics
JMP doNormalPhysics
doAimedPhysics
HandleAimedPhysics
JMP donePhysicsUpdate
doNormalPhysics:
LDA Object_x_hi,x
STA xPrev
LDA Object_y_hi,x
STA yPrev
LDY Object_type,x ;; now we can read necessary lut table values for this object.
LDA tempMaxSpeed
ASL
ASL
ASL
STA temp2 ;; temp2 now equals max speed lo
LDA tempMaxSpeed
LSR
LSR
LSR
LSR
LSR
STA temp3 ;; temp3 now equals max speed hi
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HandleHorizontalInertia
;;;;; What we have here is the new potential position.
;;;;; If we check this position for collision, we will move precisely outside of the collision,
;;;;; so that the object bumps right up against the solid.
;;;;; The same technique could be used for objects tagged as solid (like NPCs), though then we'll
;;;;; have to come up with a way to trigger them.
;;;;; all of which will happen before the object is actually drawn.
;;;;;;;;;;;;;;;;;;;;;;;;;=======================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;=======================================================;;
LDA Object_vulnerability,x
AND #%00100000
BNE noGravityPhysics ;; still handle inertia, even if the screen has gravity but this object does not.
LDA screenFlags
AND #%00100000
BEQ noGravityPhysics
JMP gravityPhysics
noGravityPhysics:
HandleVerticalInertia
;;;;; What we have here is the new potential position.
;;;;; If we check this position for collision, we will move precisely outside of the collision,
;;;;; so that the object bumps right up against the solid.
;;;;; The same technique could be used for objects tagged as solid (like NPCs), though then we'll
;;;;; have to come up with a way to trigger them.
;;;;; all of which will happen before the object is actually drawn.
JMP donePhysicsUpdate
gravityPhysics:
HandleGravity
donePhysicsUpdate:
RTS
DoLadderStuff:
CPX player1_object
BEQ dontSkipLadderStuff
JMP skipLadderStuff
dontSkipLadderStuff:
LDA Object_physics_byte,x ;; on ladder
ORA #%00000010
STA Object_physics_byte,x
LDA gamepad
AND #%00010000 ; if up is pressed
BEQ notPressingUpOnLadder
GetCurrentActionType player1_object
CMP #$04 ;; action state of climbing ladder #OBJ_INDEX_LADDER ;; compare to ladder type
BEQ dontChangeToLadderState ;; already is in ladder state
ChangeObjectState #$04, #$04
dontChangeToLadderState:
LDA Object_y_lo,x
SEC
SBC #LADDER_SPEED_LO
STA Object_y_lo,x
LDA Object_y_hi,x
SBC #LADDER_SPEED_HI
STA Object_y_hi,x
STA yHold_hi
Cmp #BOUNDS_TOP
BCS hasNotReachedTop
LDA Object_scroll,x
CMP xScroll_hi
BEQ + ;; need to reverse
;; forward auto scroll
LDA #%00000000
JMP ++
+ ;; need to reverse
LDA #%10000000
++
ORA #$02
STA align_screen_flag
LDA #ALIGN_TIMER
STA genericTimer
LDA #$01
STA prevent_scroll_flag
;JSR doTopBounds_player
hasNotReachedTop:
JMP skipLadderStuff
notPressingUpOnLadder:
LDA gamepad
AND #%00100000 ; if down is pressed
BEQ notPressingDownOnLadder
GetCurrentActionType player1_object
CMP #$04 ; #OBJ_INDEX_LADDER ;; compare to ladder type
BEQ dontChangeToLadderState2 ;; already is in ladder state
ChangeObjectState #$04, #$04
dontChangeToLadderState2:
LDA Object_y_lo,x
clc
adc #LADDER_SPEED_LO
STA Object_y_lo,x
LDA Object_y_hi,x
adc #LADDER_SPEED_HI
STA Object_y_hi,x
CMP #BOUNDS_BOTTOM
CLC
ADC Object_bottom,x
BCC skipLadderStuff
LDA Object_scroll,x
CMP xScroll_hi
BEQ + ;; need to reverse
;; forward auto scroll
LDA #%00000000
JMP ++
+ ;; need to reverse
LDA #%10000000
++
ORA #$01
STA align_screen_flag
LDA #ALIGN_TIMER
STA genericTimer
LDA #$01
STA prevent_scroll_flag
JMP skipLadderStuff
notPressingDownOnLadder:
skipLadderStuff:
RTS
DoLadderStuff:
RTS
CalculateAccAndSpeed:
LDA update_screen
BEQ doPhysics
RTS
doPhysics:
LDA gameHandler
AND #%10000000
BNE doPhysics2
RTS
doPhysics2:
CPX player1_object
BNE noAutoScroll
JSR handleAutoScroll
;JSR CheckAutoScrollLeftEdge
noAutoScroll:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA Object_vulnerability,x
AND #%00000001
BNE doAimedPhysics
JMP doNormalPhysics
doAimedPhysics
HandleAimedPhysics
JMP donePhysicsUpdate
doNormalPhysics:
LDA Object_x_hi,x
STA xPrev
LDA Object_y_hi,x
STA yPrev
LDY Object_type,x ;; now we can read necessary lut table values for this object.
LDA tempMaxSpeed
ASL
ASL
ASL
STA temp2 ;; temp2 now equals max speed lo
LDA tempMaxSpeed
LSR
LSR
LSR
LSR
LSR
STA temp3 ;; temp3 now equals max speed hi
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HandleHorizontalInertia
;;;;; What we have here is the new potential position.
;;;;; If we check this position for collision, we will move precisely outside of the collision,
;;;;; so that the object bumps right up against the solid.
;;;;; The same technique could be used for objects tagged as solid (like NPCs), though then we'll
;;;;; have to come up with a way to trigger them.
;;;;; all of which will happen before the object is actually drawn.
;;;;;;;;;;;;;;;;;;;;;;;;;=======================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;=======================================================;;
LDA Object_vulnerability,x
AND #%00100000
BNE noGravityPhysics ;; still handle inertia, even if the screen has gravity but this object does not.
LDA screenFlags
AND #%00100000
BEQ noGravityPhysics
JMP gravityPhysics
noGravityPhysics:
HandleVerticalInertia
;;;;; What we have here is the new potential position.
;;;;; If we check this position for collision, we will move precisely outside of the collision,
;;;;; so that the object bumps right up against the solid.
;;;;; The same technique could be used for objects tagged as solid (like NPCs), though then we'll
;;;;; have to come up with a way to trigger them.
;;;;; all of which will happen before the object is actually drawn.
JMP donePhysicsUpdate
gravityPhysics:
HandleGravity
donePhysicsUpdate:
RTS
DoLadderStuff:
; CPX player1_object
; BEQ dontSkipLadderStuff
; JMP skipLadderStuff
dontSkipLadderStuff:
; LDA Object_physics_byte,x ;; on ladder
; ORA #%00000010
; STA Object_physics_byte,x
; LDA gamepad
; AND #%00010000 ; if up is pressed
; BEQ notPressingUpOnLadder
; GetCurrentActionType player1_object
; CMP #$04 ;; action state of climbing ladder #OBJ_INDEX_LADDER ;; compare to ladder type
; BEQ dontChangeToLadderState ;; already is in ladder state
; ChangeObjectState #$04, #$04
dontChangeToLadderState:
; LDA Object_y_lo,x
; SEC
; SBC #LADDER_SPEED_LO
; STA Object_y_lo,x
; LDA Object_y_hi,x
; SBC #LADDER_SPEED_HI
; STA Object_y_hi,x
; STA yHold_hi
; Cmp #BOUNDS_TOP
; BCS hasNotReachedTop
; LDA Object_scroll,x
; CMP xScroll_hi
; BEQ + ;; need to reverse
; forward auto scroll
; LDA #%00000000
; JMP ++
; + ;; need to reverse
; LDA #%10000000
; ++
; ORA #$02
; STA align_screen_flag
; LDA #ALIGN_TIMER
; STA genericTimer
; LDA #$01
; STA prevent_scroll_flag
;JSR doTopBounds_player
hasNotReachedTop:
;JMP skipLadderStuff
notPressingUpOnLadder:
; LDA gamepad
; AND #%00100000 ; if down is pressed
; BEQ notPressingDownOnLadder
; GetCurrentActionType player1_object
; CMP #$04 ; #OBJ_INDEX_LADDER ;; compare to ladder type
; BEQ dontChangeToLadderState2 ;; already is in ladder state
; ChangeObjectState #$04, #$04
dontChangeToLadderState2:
; LDA Object_y_lo,x
; clc
; adc #LADDER_SPEED_LO
; STA Object_y_lo,x
; LDA Object_y_hi,x
; adc #LADDER_SPEED_HI
; STA Object_y_hi,x
; CMP #BOUNDS_BOTTOM
; CLC
; ADC Object_bottom,x
; BCC skipLadderStuff
; LDA Object_scroll,x
; CMP xScroll_hi
; BEQ + ;; need to reverse
; forward auto scroll
; LDA #%00000000
; JMP ++
; + ;; need to reverse
; LDA #%10000000
; ++
; ORA #$01
; STA align_screen_flag
; LDA #ALIGN_TIMER
; STA genericTimer
; LDA #$01
; STA prevent_scroll_flag
; JMP skipLadderStuff
notPressingDownOnLadder:
skipLadderStuff:
RTS
;;blank
CPX player1_object
BEQ isPlayerForCollectables
JMP ++
isPlayerForCollectables:
LDA tileCollisionFlag
BEQ +
JMP ++
+
LDA #$01
STA tileCollisionFlag
;ChangeTileAtCollision #11, #$00 ;; old code to change type type might use this to remove tile when blood = 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TXA
STA tempx
SubtractValue #$08, myScore, #$01, #$00
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
; LDA DrawHudBytes
; ora #HUD_myScore
; STA DrawHudBytes
UpdateHud HUD_myScore
PlaySound #SND_GET
LDA #$00
STA value
STA value+1
STA value+2
STA value+3
STA value+4
STA value+5
STA value+6
STA value+7
LDA myScore;;
AddValue #$08, myLives, #$01, #$00
STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
; LDA DrawHudBytes
; ora #HUD_myScore
; STA DrawHudBytes
UpdateHud HUD_myLives
PlaySound #SND_GET
LDA #$00
STA value
STA value+1
STA value+2
STA value+3
STA value+4
STA value+5
STA value+6
STA value+7
LDX tempx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DEC screenPrizeCounter
BNE ++
;;; do whatever should happen if you collect all of the prizes on this screen.
JSR HandleNoMorePrizeTiles
++