SpiderDave
New member
Create two files:
DoorTile.asm
Code:
CPX player1_object
beq +
jmp ++
+
lda Object_scroll,x
sta DOOR_SCREEN
lda tileX
AND #$f0
sta DOOR_X
lda tileY
AND #$f0
sta DOOR_Y
++
UseDoor.asm
Code:
; You will need to add these User Variables:
; DOOR_X
; DOOR_Y
; Make sure player is on ground
ldx player1_object
LDA Object_physics_byte,x
AND #%00000001
BEQ +
lda Object_scroll,x
cmp DOOR_SCREEN
bne +
lda Object_x_hi,x
adc #$02
AND #$f8
cmp DOOR_X
bne +
lda Object_y_hi,x
AND #$f0
cmp DOOR_Y
bne +
; wait until rendering is turned off
LDA #$00
STA soft2001
JSR WaitFrame
; do the warp
LDA warpMap
STA currentMap
CLC
ADC #$01
STA temp
GoToScreen warpToScreen, temp, #$02
+
rts
Go to "Project Settings".
Click the "Project Labels" tab.
Click "Tile Types", change "14 - NULL" to "14 - Door".
Click the "Script Settings" tab.
Find the one with "Tile Collision 14" and click the "Change" button.
In the Script field, put the path to the new "DoorTile.asm" file.
Click "OK".
Click the "User Variables" tab.
Click the "Add" button.
Click the new entry "NOT_SET -0"
Change the Name to DOOR_X
Click the "Add" button.
Click the new entry "NOT_SET -0"
Change the Name to DOOR_Y
Click the "Add" button.
Click the new entry "NOT_SET -0"
Change the Name to DOOR_SCREEN
Close the "Project Settings" dialog.
In the tree view, Project, Graphics Banks, Graphics Bank 1, click "Assets".
Change the text field with "New Asset" to "Door".
Set the Height to 2.
Click the top tile of the asset.
Select a squareoid to use for it (a solid black tile works).
Change the dropdown with "Null - Walkable 0" to "14 - Door".
Click the bottom tile of the asset.
Select a squareoid to use for it.
Click the "Save NEW" button.
You can now place a door on a screen.
To determine where it leads:
Click the "Screen Info" button.
Set the "Warp in Screen Location X, Y" fields to the x and y of your door (the lower squareoid).
This will be used when coming through to this screen from another one.
Set the "Warp out Screen X, Y" to the screen this door leads to.
You'll need to set the "Warp in Screen Location X, Y" and place a door for that screen too.
EDIT:
* Fixed a bug where you could use an invisible door on a different screen.
* Added something to turn off rendering before using a door.