(SOLVED) 4.5 Tile that Teleports Player Within Same Screen

Craigery

Active member
I am trying to make a door where when you enter it moves you to another door on the same screen, kind of like like Bugs Bunny Crazy Castle. So I have codes for 2 tiles, one that makes the player move up and one that makes the player down. Independently they both work as expected. However, when I have both as tiles one overrides the other I think due to STA Object_y_hi,y and STA yHold_hi. I am not sure how to make another Object_y_hi2 and yHold_hi2 or something like that. Am I misunderstanding this? Point me in the right direction please.


This code teleports the player up

Code:
	CPX player1_object	;;Loads Player
	BEQ startStairsUp	;;if Branch is Equal to the player? then go to startStairsUp:
	JMP endStairsUp		;;if not then end script

startStairsUp:
	LDA tileY
	ADC #$D1
	STA Object_y_hi,y
	STA yHold_hi
	ChangeActionStep #$00, #$01	;; Change to action step 01
	
endStairsUp:

and

This code teleports the player down

Code:
	CPX player1_object	;;Loads Player
	BEQ startStairsUp	;;if Branch is Equal to the player? then go to startStairsUp:
	JMP endStairsDown		;;if not then end script

startStairsDown:
	LDA tileY
	ADC #$2F
	STA Object_y_hi,y
	STA yHold_hi
	ChangeActionStep #$00, #$01	;; Change to action step 01
	
endStairsDown:
 

jorotroid

Member
What happens when you have both tiles? So if I understand correctly, the the code is supposed to move the play to a different y position, but the x position will always be the same. And from the looks of it, this is suppose to work when you collide with the tile. Are these two tiles being place on top of each other (same x coordinate)? Does it cause the game to freeze or slow down? If so, I would think the problem is that warping to one tile sends you right back to the first one, which will send you to the other and so on forever.
 

dale_coop

Moderator
Staff member
You should make the player appearing next to the tile... not on the tile itself... else you will warp cycle forever ;)
 

Craigery

Active member
Thanks for the replies, fortunately I figured it out. In both of the Tiles code i had BEQ startStairsUp and didn't change it to BEQ startStairsDown for the downward script. Thats what I get for trying to code past midnight zzzzzzz...

Dale, I am aware of the endless teleporting, but the way I have it setup you should never teleport onto another teleporting tile.
 
Top Bottom