Why did I get a key?

Nintend0Nerd

New member
I'm making a platformer game, but want to implement keys and key doors. I have an icon in my hud that appears as an x when the player doesn't have a key, and then shows a key symbol when they get one (the player should only ever have one key at a time). For some reason, when I jump on an enemy in the first room (but not when I shoot it with a projectile) I get a key when I move onto the next room. Does anyone know why this is happening?
 

TurtleRescueNES

Active member
Can you change the HUD to show keys as a number intead of a symbol? I could be wrong, but I think there is a glitch involving tracking keys as a variable image type.
 

Nintend0Nerd

New member
I changed it to a number. Every time I go back to that screen and kill the enemy and switch screens the amount goes up by one. Does it have to do with something in the platformer module? Since keys aren't meant to be used there.
 

dale_coop

Moderator
Staff member
You might have modified a script, monster death? Or drops? Modifying the « myKeys » variable?
 

Nintend0Nerd

New member
I haven't modified any monster death scripts or edited the myKeys variable. Still not sure what's causing the issue.
 
Some variables are "hard" coded to be specific things.

It sounds like what you're using for your keys, is actually the myScore variable. There's a specific entry in the variables that, by default, controls keys.
 

Nintend0Nerd

New member
I was wondering if it was connected to score too, but I erased the code for score (because I don't need it), and the key count still increases.
 
Nintend0Nerd said:
I was wondering if it was connected to score too, but I erased the code for score (because I don't need it), and the key count still increases.

Score gets incremented in a lot of places. Deleting it in 1 place wouldn't stop it from working (If it did, you probably wouldn't be able to compile at all) I'm not at home right now, so I can't check, but make sure you're using the correct variable for keys. You should be able to verify which variable it is by setting the type to "Variable", and it should spell out what it's doing (myScore, myKeys, myHealth, I think are the default)
 
Top Bottom