Prev: A830 Up: Map Next: A8C1
A89C: Create Tumbleweed
Used by the routine at CreateTownObjects.
Called every frame in town. From level eight onwards it puts a tumbleweed (an object of type 17) in the ninth object slot, next to the sheriff, if the slot is free.
From level eight onwards, use the ninth slot if it is free.
CreateTumbleweed A89C LD A,($A260) Fetch the level.
A89F CP $08 Compare it with eight.
A8A1 RET C Return if the level is below eight.
A8A2 LD DE,$A2FD Point DE at ObjectSlot_09.
A8A5 LD A,(DE) Fetch the type of the object in the slot.
A8A6 AND A Return if the slot is in use.
A8A7 RET NZ
Copy the template and place the tumbleweed near the sheriff.
A8A8 PUSH DE Copy DE to IY (using the stack).
A8A9 POP IY
A8AB LD HL,$A8C1 Point HL at TumbleweedTemplate.
A8AE LD BC,$0010 Set the size of an object slot in BC.
A8B1 LDIR Copy the template into the slot.
A8B3 LD B,$01 Set the distance from the sheriff to one cell.
A8B5 CALL PlaceNearSheriff Place the tumbleweed one cell away from the sheriff.
A8B8 RET NZ Return if that cell is blocked.
A8B9 CALL SetPositionInCell Set the position of the tumbleweed within its cell.
A8BC LD (IY+$00),$17 Turn the slot into a tumbleweed.
A8C0 RET Return.
Prev: A830 Up: Map Next: A8C1