Jump to content


Photo

Letting The Correct Mario Powerup To Next Stage


  • Please log in to reply
5 replies to this topic

#1 ChiusaTheLooza

ChiusaTheLooza

    GMC Member

  • New Member
  • 6 posts
  • Version:GM8

Posted 22 September 2012 - 09:19 PM

Hello, thanks for considering to help.
I have a lot of aspects of Mario in the first level of my game. Mario comes in three different objects in my game, small mario, big mario, and mario with fire power up.
My question is, how do I let the game know which Mario I want to advance to the next stage? If Fire mario reaches the end of the level, how can the game know which mario would end up on the other side when switching rooms?
Most of my game is drag and drop, but if this is not accomplish-able with that, then of course feel free to post a code.
Thanks guys. I appreciate it a lot.
(Game Maker Version 8.1 Lite)
  • 0

#2 Brawl

Brawl

    Magnitude Games

  • Retired Staff
  • 489 posts
  • Version:GM:Studio

Posted 22 September 2012 - 09:30 PM

You are going to need a global variable. This means that no matter what the conditions, the variable will always be there unless you manually change it. Global variables aren't tied to a single object like local variables.

global.marioPower=0 //Small Mario
global.marioPower=1 //Big Mario
global.marioPower=2 //Fire Mario

Even if you don't know code, I'd imagine you understand what's going on so far. You can also use Drag and Drop for these if you'd like. That much should be straight forward. If it's not, I'll explain more for you.

Whenever Mario gets a powerup you should execute the corresponding line. Of course, don't use all three at once. That would just end you up with Fire Mario. Whenever your next room starts just check the global.marioPower variable and create whichever Mario object that goes along with it.

Make sense?

Edited by Brawl, 22 September 2012 - 09:31 PM.

  • 0

#3 ChiusaTheLooza

ChiusaTheLooza

    GMC Member

  • New Member
  • 6 posts
  • Version:GM8

Posted 22 September 2012 - 09:37 PM

You are going to need a global variable. This means that no matter what the conditions, the variable will always be there unless you manually change it. Global variables aren't tied to a single object like local variables.

global.marioPower=0 //Small Mario
global.marioPower=1 //Big Mario
global.marioPower=2 //Fire Mario

Even if you don't know code, I'd imagine you understand what's going on so far. You can also use Drag and Drop for these if you'd like. That much should be straight forward. If it's not, I'll explain more for you.

Whenever Mario gets a powerup you should execute the corresponding line. Of course, don't use all three at once. That would just end you up with Fire Mario. Whenever your next room starts just check the global.marioPower variable and create whichever Mario object that goes along with it.

Make sense?


Ahh! Global variable, it sounds like what I had pictured in my head for the solution I would need. Thanks for the code example. I'm going to try and implement this, thanks a lot Brawl, I'll post back if I do it correctly/if it does what I need.
  • 0

#4 Brawl

Brawl

    Magnitude Games

  • Retired Staff
  • 489 posts
  • Version:GM:Studio

Posted 22 September 2012 - 09:39 PM

All right. Feel free to ask if you don't understand something or need more help.
  • 0

#5 ChiusaTheLooza

ChiusaTheLooza

    GMC Member

  • New Member
  • 6 posts
  • Version:GM8

Posted 22 September 2012 - 09:46 PM

YES! It has worked! I don't know if it means much for a n00b to thank someone for solutions that are probably no-brainer'ed for you, but it's something that has troubled me for a while.
Thanks again bud.
  • 0

#6 Brawl

Brawl

    Magnitude Games

  • Retired Staff
  • 489 posts
  • Version:GM:Studio

Posted 22 September 2012 - 10:03 PM

YES! It has worked! I don't know if it means much for a n00b to thank someone for solutions that are probably no-brainer'ed for you, but it's something that has troubled me for a while.
Thanks again bud.


Of course it means something. It's always nice to know that I can help people out, even in the most simple ways. Everyone starts somewhere, and I was in your shoes once.

Glad to help.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users