Flea Game and some help needed (demo)

wallmasterr

Active member
Iv added a swim feature using the laderscript. Stoll the idea from ploid.
https://twitter.com/Wallmasterr/status/1254371122197520385

Does anyone know how I turn off the press up to hover thing? the ladder script is pretty small so I assume the code might be in the physics asm? I dont need laders to function like laders in my game so its ok to mess with it. Though i do use them for bounce pads, will split into separate tyle types if needed.

ladder.asm iv tried commenting ou both and does not work :p
Code:
;;; maybe it's possible to ONLY do this if the ladders is underneath my feet

	LDA #%00000010
	STA tile_solidity
Sorry about spaming this thread with posts from my twitter, its just the easyest way iv found to post gifs on here.
 

wallmasterr

Active member
dale_coop said:
Yep, ladder code is in the Physics script... and also some code in the Extra Controls Script.
Thanks Dale
im managing to get something working. Iv just tried to comment out anything to do with climbing or up and down button codes till it does what i want.

ExtraControllReadCode.asm (this stops the player from sticking to the ladder but they can still press up and down)
Code:
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

The other one im lookin at is
Pysics_4_1_0.asm (when i start randomly comenting out stuff in here around the "AND #%00010000 ; if up is pressed" and "AND #%00100000 ; if down is pressed" things just start to break in weird ways, how do i just strip out up and down buttons alltogether?)

Code:
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
 

dale_coop

Moderator
Staff member
in the physics script, I think you could just remove (or comment out) all the code between, the line:
Code:
DoLadderStuff:
and the
Code:
RTS

Also... modify the value of the user constant "COL_INDEX_LADDER"... to something else that is not used in your project, like anything greater than 16 ;)
 

wallmasterr

Active member
Thanks again Dale that seems to have done the trickbut had to keep the lines with : at the end or the physics just broke.
Code:
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
 

dale_coop

Moderator
Staff member
This is strange, having just :
Code:
 DoLadderStuff:
	RTS
should work.

Edited: yep, tested, it work on my demo project.
 

wallmasterr

Active member
Mabie i broke stuff in other parts of the ladder stuff?

I also keep getting a bug where my warp screen tile just kill you.
can sometimes fix it by duplicating the screen , deleting it then puting it back.
Anyone else ever had this ?
Is it something to do with the underworld? i have no idea but its really annoying.
 

wallmasterr

Active member
https://twitter.com/Wallmasterr/status/1255923722659270659

Managed to cobble this together from a couple of diferent scripts, almost works.
How do i go about checking if the score is 0 before doing add lives bit?
Code:
;;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

++
 

dale_coop

Moderator
Staff member
You should add the checking for score at the beginning of your script...
the code itself would be (for a 4 digit score hud variable):
Code:
LDA myScore+3
BNE +
LDA myScore+2
BNE +
LDA myScore+1
BNE +
LDA myScore
BNE +
JMP ++
+
 

wallmasterr

Active member
Is there a way to change the palette for a screen every few seconds, was hoping i could attach it to a npc script for the rave in the tapeworm disco.
 

wallmasterr

Active member
My friend managed to modify a nes emulator for the Dreamcast to autoload a nes game and show a custom vmu image :D Il share more soon.
Only uses mapper 2 at the moment (need to convert from 30), I need to do a deep test on flea when its all finished.
fleaDC.jpg
 
Top Bottom