Why did I get a key?

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
Post Reply
User avatar
Nintend0Nerd
Posts: 44
Joined: Tue Sep 25, 2018 4:33 pm
Location: Illinois

Why did I get a key?

Post by Nintend0Nerd » Mon Oct 08, 2018 10:01 pm

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?
User avatar
jsherman
Posts: 150
Joined: Sun Apr 22, 2018 11:25 am
Location: Cleveland OH

Re: Why did I get a key?

Post by jsherman » Tue Oct 09, 2018 12:20 am

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.
"Turtle Rescue" updates can be found here: viewtopic.php?f=13&t=112
User avatar
Nintend0Nerd
Posts: 44
Joined: Tue Sep 25, 2018 4:33 pm
Location: Illinois

Re: Why did I get a key?

Post by Nintend0Nerd » Tue Oct 09, 2018 1:43 am

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.
User avatar
dale_coop
Posts: 1294
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Why did I get a key?

Post by dale_coop » Tue Oct 09, 2018 6:18 am

You might have modified a script, monster death? Or drops? Modifying the « myKeys » variable?
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
Nintend0Nerd
Posts: 44
Joined: Tue Sep 25, 2018 4:33 pm
Location: Illinois

Re: Why did I get a key?

Post by Nintend0Nerd » Fri Oct 12, 2018 12:03 am

I haven't modified any monster death scripts or edited the myKeys variable. Still not sure what's causing the issue.
User avatar
Convoy_Avenger
Posts: 63
Joined: Tue Aug 14, 2018 1:42 am

Re: Why did I get a key?

Post by Convoy_Avenger » Fri Oct 12, 2018 11:41 am

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.
User avatar
Nintend0Nerd
Posts: 44
Joined: Tue Sep 25, 2018 4:33 pm
Location: Illinois

Re: Why did I get a key?

Post by Nintend0Nerd » Fri Oct 12, 2018 12:28 pm

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.
User avatar
Convoy_Avenger
Posts: 63
Joined: Tue Aug 14, 2018 1:42 am

Re: Why did I get a key?

Post by Convoy_Avenger » Fri Oct 12, 2018 4:50 pm

Nintend0Nerd wrote:
Fri Oct 12, 2018 12:28 pm
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)
Post Reply