Jump to content


Photo

Metroidvania Chests


  • Please log in to reply
8 replies to this topic

#1 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 09 February 2012 - 10:24 PM

Hello, I'm making a Metroidvania game. I already have have the moving from room to room down, but I don't know how to go about making chests. I've already looked around but I couldn't understand the codes, and I use GM8.1 Registered.

Thanks.
  • 0

#2 koo294

koo294

    GMC Member

  • GMC Member
  • 205 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:23 PM

What do you want the chests to do, exactly? I presume they will be objects that give you something.
  • 0

#3 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:24 PM

I want them to open and throw out an object i can assign, then the player can go pick it up.
  • 0

#4 koo294

koo294

    GMC Member

  • GMC Member
  • 205 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:34 PM

then i would suggest something like putting this in the collision event of the chest with the player:
if (keyboard_check(vk_space)) and (opened = 0) //replace vk_space with button pressed to open chest (ord('E') for letter e, for example)
	{
	opened = 1;
	instance_create(x,y,item);
	}
set opened to 0 in the chest create event. Set item to the object name of the item by right clicking on the chest in the room editor and in the dropdown menu select 'creation code...' and setting it in there.

Edited by koo294, 09 February 2012 - 11:35 PM.

  • 0

#5 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:41 PM

But the thing is... Will it stay from room to room?
  • 0

#6 Caracol

Caracol

    GMC Member

  • GMC Member
  • 153 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:46 PM

Set the room to be persistent. This makes it so that any instances left in the room are in the same state when that room is returned to.
  • 0

#7 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 09 February 2012 - 11:46 PM

Alright, thanks guys I'll see if it will work.
  • 0

#8 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 10 February 2012 - 12:41 AM

It worked thanks guys. :biggrin:
  • 0

#9 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 10 February 2012 - 12:45 AM

Now how do I change the title name... This being my first cry for help. :thumbsup:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users