Fangames > Programming Questions

Back to hub key?

(1/3) > >>

Hop:
Hey I'm trying to have a hub room at the end of my game where you can revisit screens if you wish. After reaching the hub room I want the player to be able to press a key and return to the hub at anytime. I was trying to use a persistent key press object, but it just broke my game. So how would I implement something like this? An example would be being able to go back in bmxbandit's game Meltdown to do needle or fight a boss by pressing backspace.

I'm using Yoyo's Studio Engine.

Thanks!

Derf:
Put a keyboard press event for whatever key you want in the world object and put code to the effect of this:


--- Code: ---with(objPlayer){
     instance_destroy();
}

room_goto(rHub);
--- End code ---

Hop:
How do I make it so that the key only works after you've been to the hub before though?

Kyir:
Do you already have some sort of secret/item array in place in your code? If so, you just set one value of it to true whenever you enter the hub and check if that value is true before executing the code upon key press.

xElectricZz:
Here: https://pastebin.com/K3ypy0xF

I hope that works for you.

Navigation

[0] Message Index

[#] Next page

Go to full version