LDX player1_object
; get horizontal offset of Player
LDA Object_x_hi,x
; get vertical offset of Player
LDA Object_y_hi,x
; get horizontal offset of Player
LDA Object_y_hi,x ; load x offset of X (player1 is loaded in X above)
SEC ; set carry
SBC #$10 ; substract 16 pixels (substract for moving up, add for moving down)
STA Object_y_hi,x ; store the new value in player1's position
;PlaySound #sfx_step
RTS
jcramer said:Here's what I'm using for up. i tried mixing it with parts of the regular movement scripts but didn't work.
LDX player1_object
; get horizontal offset of Player
LDA Object_x_hi,x ;; Get this object's origin location
CLC
ADC self_center_x
;; add offset based on direction below
STA tempA
; get vertical offset of Player
LDA Object_y_hi,x
CLC
ADC self_center_y
;; add offset based on direction below
;; look 1 tile up from player
SEC
SBC #$10
STA tempB
; check if tile is solid if so don't move
GetCollisionPoint tempA, tempB, tempA
CMP #$01
BEQ +end
; if not solid move 1 tile
; set tempA to object x position for LR scripts
;LDA tempA
;STA Object_x_hi,x ; store the new value in player1's position
; set tempB to object y position for UD scripts
LDA tempB
STA Object_y_hi,x ; store the new value in player1's position
;PlaySound #sfx_step
+end
RTS
Hmm... definitely worked on my maze game test...jcramer said:For some reason, it still doesn't work. Like if I set the solid object reaction to "destroy me" it'll kill the player, but stop doesn't work.