[4.5.9] Modified Change Tile Collision Script (Tile Type)

Jonny

Well-known member
Let me know if this is useful and how you might use it, or any problems.
You may want to change object size and bounding box to get desired effect.

anvilthing.gif anvilthing2.gif

Code:
;;; WAIT UNTIL SCREEN HAS UPDATED ;;;;;;;;;;;;;;;;;;;;;;;;;;

    LDA updateScreenData
    AND #%00000100
    BEQ screenUpdated
    RTS
screenUpdated:

;;; CHECK NOT PLAYER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   
    CPX player1_object              ;; COMPARE X TO P1O   ;;
    BNE isNotPlayer
    JMP notMonster                  ;; DONT CHANGE TILE   ;;
isNotPlayer:

;;; TILE CHANGE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    LDA Object_v_speed_hi,x         ;; CHECK MOVING DOWN  ;;
    BEQ changeToChain              
    BMI changeToChain               ;; EQUAL OR NEGATIVE  ;;
    JMP changeToWall

changeToChain:
    ChangeTileAtCollision #00, #$0C ;; TILE FOR UP        ;;
    RTS
   
changeToWall:
    ChangeTileAtCollision #76, #$0C ;; TILE FOR DOWN      ;;
    RTS

notMonster:
 

Jonny

Well-known member
This would be perfect for my upcoming spider monster!

That's so wierd, I had the same idea because, for a scrolling game, if you leave the screen (and destroying monster at screen edge) whichever tiles have been changed stay that way. So, it looks odd for a scrolling game the way I'm using it in the example above. For a spiders web its perfect because if the web was still there after the monster object was gone it would'nt look wrong.

Have you got a spider graphic already? :unsure:
 

CluckFox

Active member
Spider

nfyGyPO.gif


I'm working on smoothing out the transition but it works quite well!
 

CluckFox

Active member
Smoother spider
xOkXrlJ.gif


Here's the code modifications I made:

Code:
;; tile stuff - by Jonny
;;; WAIT UNTIL SCREEN HAS UPDATED ;;;;;;;;;;;;;;;;;;;;;;;;;;
FAKE_OBJECT_HEIGHT=$0e ;; (spider's bbox top + height)
    LDA updateScreenData
    AND #%00000100
    BEQ screenUpdated
    RTS
screenUpdated:

;;; CHECK NOT PLAYER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   
    CPX player1_object              ;; COMPARE X TO P1O   ;;
    BNE isNotPlayer
    JMP notMonster                  ;; DONT CHANGE TILE   ;;
isNotPlayer:
    JSR +checkMonsterLowerLeft      ;; this collision is  ;;
    BEQ +                           ;; only for the lower ;;
    JMP notMonster                  ;; left bbox corner   ;;

    +
;;; TILE CHANGE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    LDA Object_direction,x          ;; CHECK MOVING DOWN  ;;
    AND #%00110000
    CMP #DOWN
    BEQ changeToChain              
    JMP changeToWall

changeToChain:
    ChangeTileAtCollision #$c2, #$0d ;; TILE FOR UP        ;;
    RTS
   
changeToWall:
    ChangeTileAtCollision #$4e, #$0d ;; TILE FOR DOWN      ;;
    RTS

+checkMonsterLowerLeft
LDA Object_y_hi,x
CLC
ADC #FAKE_OBJECT_HEIGHT
AND #%11110000
CMP tileY
RTS

notMonster:
 

JRS

New member
i noticed that this also acts as a ladder for some reason
also you can use this code to cut through vegetation or smash vases with your attack in adventure mod just like that cheeky pot smashing git Link !!!
 

Jonny

Well-known member
i noticed that this also acts as a ladder for some reason
also you can use this code to cut through vegetation or smash vases with your attack in adventure mod just like that cheeky pot smashing git Link !!!
That's my fault. I forgot to mention that my physics doesn't include the ladder code. You could use a different tile.
Certain tiles, such as the jumpthough/oneway and ladder and trampoline etc, depending on which module you start with, are coded in places other than the tiletype script itself. Mostly in doHandlePhysics and some input scripts. If you assign it to a different tiletype, it shouldn't act as a ladder.
 
Top Bottom