Maze Game activate switches to open level exits.

PewkoGames

Member
So I'm working on a maze game, and the idea is the player has to avoid enemies while activating 4 switches on 4 corners of the screen. When you activate 4 switches the exit at the top of the level opens and you have to reach it to move on to the next level. My question is: How would you do that?

I also want there to be 1 power up/weapon that you can pick up and hold onto until you hit an enemy. Its like a one time invincibility that you have to save and use at the right moment. And when you kill whatever enemy they stay dead instead of the Pacman style temporary death.

If anyone could help out that would be great!
 

dale_coop

Moderator
Staff member
You could use the key tiles / lecked door tile system? (or even with collectable tiles?)
When you got 4 you could open the door....
 

PewkoGames

Member
I was thinking that, but A) What scripts do add to the Maze Game Module that get it to work (I assaigned GetKey and LockedDoor ASM to null tiles but I got unkown label errors)and B) How do I get it so by collecting 4 you open the exit? Just FYI I want it to be when you collect 4 it opens on its own and you have to avoid the monsters on your way back to the open exit.
 

dale_coop

Moderator
Staff member
Yep, exactly, assign the KeyPickup script and the LockedDoor (from the "Basic\ModuleScripts\TileScripts\Adventure" folder foe example) to unused Tile Collision XX.
Then for the unknown label errors... it's because you need to add :
- a user constants "myKeys" (init value "0") in the "HUD & Boxes > Users Variables".
- a user constant "TILE_OPENDOOR" (value "0") in "Project Settings > User Constants".
- a SFX "SND_UNLOCK" in "Sound > SFX".

And for the check "4" collected... modify the "LockedDoor" script (or make a copy and use the copy), then replace the:
Code:
	LDA myKeys
	BNE + ;; if you have no more keys.
With:
Code:
	LDA myKeys
	CLC
	CMP #$04
	BCS + ;; if you have no more keys.

And the:
Code:
	SubtractValue #$02, myKeys, #$01, #$00
With:
Code:
	; SubtractValue #$02, myKeys, #$01, #$00
	LDA #$00
	STA myKeys	;; re-init the myKeys variable to 0
 

PewkoGames

Member
Hey it worked! However, when I Open the door I can just walk to the next room. I want it when you touch/open the door, you play the victory animation and it warps you to the next level.
 

dale_coop

Moderator
Staff member
No problem for that ;)
Modify your LockedDoor script, just after the Triggerscreen line, add that portion of code:

Code:
	;; TriggerScreen screenType

	TXA
	STA tempx
	LDX player1_object
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1
	CreateObject temp, temp1, #OBJ_PLAYER_VICTORY, #$00, currentNametable
	LDX player1_object
	DeactivateCurrentObject
	LDA #$01
	STA loadObjectFlag
	StopSound
	LDA #$ff
	
	PlaySound #SND_VICTORY
	LDX tempx
 

PewkoGames

Member
YAY! It works!

a few more questions:

If I want to make different collectables worth different amounts of points, Would I just copy the script for each collectable and alter the point values? or do I have to do it another way?

is it possible to have the point values appear when you collect each collectable? Like when you collect one and "200" appears for a second before dissapearing?

When I get invincibilty, is it possible to change the animation of the player? I want it to look like the player is stabbing a knife like Chucky the doll as she's invlnerable.

and finally is it possible for the monsters that get killed to stay dead? as opposed to just resetting?
 

dale_coop

Moderator
Staff member
Yep to have different worth amounts you could copy the script... you might need to modify some labels (because you can't use the same label more than once in the project).
Another easy way... I don't see any.
Same for the "points" appearing when collecting. It could be objects, created by the collectable script. It's not very complicated, but If you know nothing about coding, maybe it would seem difficult for you.

For the invincibility... it's using an Action Step (I think it's the Action Step 3, if I remember well). So just use a custom Chucky-ish animation for that action step ;)
Sadly, your killed monsters can not stay dead.

You could trigger the screen, so when re-enter you will have no more monsters on screen. But how is working on your game right now? You can leave the screen and re-enter into it? (I thought it was a 1 screen maze with a warp to another screen on victory).
 

PewkoGames

Member
Hey! so to answer your question its a 1 screen maze with a warp to another screen on victory. The monster death isn't that big an issue either. As far as the points appearing I may need help with that
 

Razzie.P

Member
PewkoGames said:
When I get invincibilty, is it possible to change the animation of the player? I want it to look like the player is stabbing a knife like Chucky the doll as she's invlnerable.


In your player object, you can click on "Manage animations," then click "add" to add whatever you'd like, such as "chuckstab_left, chuckstab_up, chuckstab_down" etc. Click "close," then you can simply add your animation tiles to the animation/frame by selecting via the dropdown. You'd have to create the actual graphics, of course, using the pixel editor or an external graphics program, but you probably knew that.
 

PewkoGames

Member
Razzie.P said:
PewkoGames said:
When I get invincibilty, is it possible to change the animation of the player? I want it to look like the player is stabbing a knife like Chucky the doll as she's invlnerable.


In your player object, you can click on "Manage animations," then click "add" to add whatever you'd like, such as "chuckstab_left, chuckstab_up, chuckstab_down" etc. Click "close," then you can simply add your animation tiles to the animation/frame by selecting via the dropdown. You'd have to create the actual graphics, of course, using the pixel editor or an external graphics program, but you probably knew that.

Yeah I figured out how to do that, and I do all my graphics so i am very skilled in that department :)
 

Razzie.P

Member
I've been playing around with the code you guys used to "unlock the door after 4 keys are collected." Pretty sweet! Any idea how it can be modified to play a sound to notify the player when the 4th key is collected and the door is unlocked? I know the code to play the sound, just not sure where to put it to make it play when that 4th key is touched.
 

dale_coop

Moderator
Staff member
Razzie.P said:
Any idea how it can be modified to play a sound to notify the player when the 4th key is collected and the door is unlocked? I know the code to play the sound, just not sure where to put it to make it play when that 4th key is touched.

You could modify the keyPickup.asm script, in the code where the sound of collecting a key is played... currently the line looks like:
Code:
	PlaySound #SND_GET

Just replace that line, by all that code (check how many keys we collected yet, and play a different sfx if 4th or more):
Code:
	LDA myKeys
	CLC
	CMP #$04	;; check if got 4 keys or more
	BCS gotAllKeys
	PlaySound #SND_GET
	JMP continueForCollectableKeys
gotAllKeys:
	PlaySound #SND_GET_4
continueForCollectableKeys:

And add a new SFX named "SND_GET_4" in "Sound > SFX" to be played when you got last key (the 4th key).
 
Top Bottom