Prev: 43056 Up: Map Next: 43201
43164: 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 23) 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 43164 LD A,(41568) Fetch the level.
43167 CP 8 Compare it with eight.
43169 RET C Return if the level is below eight.
43170 LD DE,41725 Point DE at ObjectSlot_09.
43173 LD A,(DE) Fetch the type of the object in the slot.
43174 AND A Return if the slot is in use.
43175 RET NZ
Copy the template and place the tumbleweed near the sheriff.
43176 PUSH DE Copy DE to IY (using the stack).
43177 POP IY
43179 LD HL,43201 Point HL at TumbleweedTemplate.
43182 LD BC,16 Set the size of an object slot in BC.
43185 LDIR Copy the template into the slot.
43187 LD B,1 Set the distance from the sheriff to one cell.
43189 CALL PlaceNearSheriff Place the tumbleweed one cell away from the sheriff.
43192 RET NZ Return if that cell is blocked.
43193 CALL SetPositionInCell Set the position of the tumbleweed within its cell.
43196 LD (IY+0),23 Turn the slot into a tumbleweed.
43200 RET Return.
Prev: 43056 Up: Map Next: 43201