Jump to content


Photo

How do I change a sprite in a different room.


  • Please log in to reply
6 replies to this topic

#1 pubbytv

pubbytv

    GMC Member

  • New Member
  • 3 posts
  • Version:GM8

Posted 10 August 2012 - 05:14 PM

So, here's what I'm dealing with. I'm making a game named 'Megaman Battle Network CYBEAST ONLINE' and I'm having a little trouble. Here's my issue.

There is a "Choose Cross" screen, which is it's own room. When you hover over a "cross" it doubles in size. When you click it, you go to, what I've called, Trialnet. If you click on an object --Badnavi-- on the Trialnet you go to a "battlefield" room. My issue lies when I click the "cross" I want it to become the sprite in the "battlefield" room. For my first "cross", the "aqua cross" I've made the "Left Pressed" event both the "Go to room trialnet" and "Change sprite into aqua (Applies to object: player)" actions. When I begin the game I click on the "aqua cross", go to the Trialnet, but when I press on the Badnavi the player sprite has not changed. Help?

~Pubby Paquette

Edited by pubbytv, 10 August 2012 - 05:15 PM.

  • 0

#2 Mr B

Mr B

    GMC Member

  • GMC Member
  • 172 posts

Posted 10 August 2012 - 06:02 PM

Just make a global variable. Set it in the first room and then check in the next.
  • 0

#3 pubbytv

pubbytv

    GMC Member

  • New Member
  • 3 posts
  • Version:GM8

Posted 10 August 2012 - 07:53 PM

Just make a global variable. Set it in the first room and then check in the next.


I started using Game Maker 8.1 about 3 days ago, so may I ask how to make this "global variable"?
  • 0

#4 Untaken

Untaken

    GMC Member

  • GMC Member
  • 106 posts
  • Version:GM8

Posted 10 August 2012 - 10:35 PM

In the object you're using for the Crosses, put global.Cross="" (or whatever you want to call the variable) into it's Create event then on Left Pressed use global.Cross= <Cross standing sprite name>. Put global.Cross into what you want to change the sprite into and it should work.
  • 0

#5 pubbytv

pubbytv

    GMC Member

  • New Member
  • 3 posts
  • Version:GM8

Posted 10 August 2012 - 11:17 PM

In the object you're using for the Crosses, put global.Cross="" (or whatever you want to call the variable) into it's Create event then on Left Pressed use global.Cross= <Cross standing sprite name>. Put global.Cross into what you want to change the sprite into and it should work.


So what I did is added a code action to the Left Pressed and it was "global.aqua=<player_ready>", and I get the error
"FATAL ERROR in
action number 3
of Mouse Event for Left Pressed
for object aqua:

COMPILATION ERROR in code action
Error in code at line 1:
global.aqua=<player_ready>
^
at position 8: Variable name expected."

What should I do? Pictures would help; sorry, I'm not the brightest.
  • 0

#6 Splaff

Splaff

    GMC Member

  • GMC Member
  • 71 posts
  • Version:GM8

Posted 11 August 2012 - 03:08 AM

Don't actually encapsulate the sprite name with greater than/less than signs; he just meant to use that as a placeholder for your actual resource name.
  • 0

#7 Chris_Devl

Chris_Devl

    The Next Gabe Newell

  • GMC Member
  • 321 posts
  • Version:GM8

Posted 11 August 2012 - 03:24 AM

If you're coding this, global.aqua = player_ready

Then in the object that you want to change the sprite in, in room_start event: sprite_index = global.aqua
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users