mirror of
https://github.com/jeremysrand/colourgo.git
synced 2025-01-24 00:30:43 +00:00
Improve gravity and jump speed. Only jump on button changes, not if held down.
This commit is contained in:
parent
727133404a
commit
ed3bfb9888
@ -42,8 +42,8 @@ CHAR_STATE_NONE=0
|
|||||||
CHAR_STATE_JUMPING=1
|
CHAR_STATE_JUMPING=1
|
||||||
CHAR_STATE_FALLING=2
|
CHAR_STATE_FALLING=2
|
||||||
|
|
||||||
JUMP_SPEED=$FF-5
|
JUMP_SPEED=$FF-4
|
||||||
GRAVITY=1
|
GRAVITY=64
|
||||||
|
|
||||||
GRID_YPOS=150
|
GRID_YPOS=150
|
||||||
|
|
||||||
@ -281,11 +281,22 @@ LINE191 = LINE190 + 1024
|
|||||||
lda characterYBottom
|
lda characterYBottom
|
||||||
sta characterOldYBottom
|
sta characterOldYBottom
|
||||||
|
|
||||||
|
lda BUTN1
|
||||||
|
bpl @L7
|
||||||
|
lda #$01
|
||||||
|
jmp @L8
|
||||||
|
@L7:
|
||||||
|
lda #$00
|
||||||
|
@L8:
|
||||||
|
cmp lastButtonState
|
||||||
|
beq @L3
|
||||||
|
sta lastButtonState
|
||||||
|
|
||||||
lda characterState
|
lda characterState
|
||||||
cmp #CHAR_STATE_JUMPING
|
cmp #CHAR_STATE_JUMPING
|
||||||
beq @L2
|
beq @L2
|
||||||
lda BUTN1
|
lda lastButtonState
|
||||||
bpl @L3
|
beq @L3
|
||||||
ldx characterNumJumps
|
ldx characterNumJumps
|
||||||
cpx #CHAR_MAX_JUMPS
|
cpx #CHAR_MAX_JUMPS
|
||||||
beq @L3
|
beq @L3
|
||||||
@ -295,15 +306,18 @@ LINE191 = LINE190 + 1024
|
|||||||
sta characterState
|
sta characterState
|
||||||
lda #JUMP_SPEED
|
lda #JUMP_SPEED
|
||||||
sta characterYSpeed
|
sta characterYSpeed
|
||||||
|
lda #0
|
||||||
|
sta characterYSpeedFrac
|
||||||
jmp @L3
|
jmp @L3
|
||||||
|
|
||||||
@L2: ; Character is jumping
|
@L2: ; Character is jumping
|
||||||
lda BUTN1
|
lda lastButtonState
|
||||||
bmi @L3
|
beq @L3
|
||||||
lda #CHAR_STATE_FALLING
|
lda #CHAR_STATE_FALLING
|
||||||
sta characterState
|
sta characterState
|
||||||
lda #0
|
lda #0
|
||||||
sta characterYSpeed
|
sta characterYSpeed
|
||||||
|
sta characterYSpeedFrac
|
||||||
|
|
||||||
@L3: ; Done changing character jumping state
|
@L3: ; Done changing character jumping state
|
||||||
lda characterState
|
lda characterState
|
||||||
@ -318,14 +332,20 @@ LINE191 = LINE190 + 1024
|
|||||||
sta characterYBottom
|
sta characterYBottom
|
||||||
lda #0
|
lda #0
|
||||||
sta characterYSpeed
|
sta characterYSpeed
|
||||||
|
sta characterYSpeedFrac
|
||||||
lda #CHAR_STATE_NONE
|
lda #CHAR_STATE_NONE
|
||||||
sta characterState
|
sta characterState
|
||||||
|
lda #0
|
||||||
|
sta characterNumJumps
|
||||||
jmp @L6
|
jmp @L6
|
||||||
@L5: ; Did not hit the grid, update speed from gravity
|
@L5: ; Did not hit the grid, update speed from gravity
|
||||||
sta characterYBottom
|
sta characterYBottom
|
||||||
lda characterYSpeed
|
lda characterYSpeedFrac
|
||||||
clc
|
clc
|
||||||
adc #GRAVITY
|
adc #GRAVITY
|
||||||
|
sta characterYSpeedFrac
|
||||||
|
bcc @L6
|
||||||
|
inc characterYSpeed
|
||||||
bmi @L6
|
bmi @L6
|
||||||
lda #CHAR_STATE_FALLING
|
lda #CHAR_STATE_FALLING
|
||||||
sta characterState
|
sta characterState
|
||||||
@ -345,6 +365,10 @@ LINE191 = LINE190 + 1024
|
|||||||
stx characterPos
|
stx characterPos
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; Local
|
||||||
|
lastButtonState: .BYTE $00
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@ -692,6 +716,7 @@ characterOldYBottom: .BYTE GRID_YPOS
|
|||||||
characterState: .BYTE CHAR_STATE_NONE
|
characterState: .BYTE CHAR_STATE_NONE
|
||||||
characterNumJumps: .BYTE $00
|
characterNumJumps: .BYTE $00
|
||||||
characterYSpeed: .BYTE $00
|
characterYSpeed: .BYTE $00
|
||||||
|
characterYSpeedFrac: .BYTE $00
|
||||||
|
|
||||||
gridColour: .BYTE COL_VIOLET
|
gridColour: .BYTE COL_VIOLET
|
||||||
gridY: .BYTE GRID_YPOS
|
gridY: .BYTE GRID_YPOS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user