Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Zelda Keys and locked doors example.  (Read 1887 times)

0 Members and 1 Guest are viewing this topic.
Zelda Keys and locked doors example.
« on: August 11, 2006, 05:12:54 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 51
hey
Does anyone know how to make key and lock system, like in zelda or is there a tutorial or and engine that could help me. Thanks a lot
~CJ
Logged
~CJ






King Tetiro

Leader of Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #1 on: August 11, 2006, 05:28:27 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Yeah I do. If you use it, you have to credit Moree too. It's GM6.1.Use only if the Hero is PERSISTANT.

_-This is a number.

Hero-Game Start
global.key_lev_=0-This is so the key can't be picked up again
global.lev_keys=0-This is how many keys there are in level ___
global.lev_key_=0(or false)-Stops the door appearing if opened

Collision with key

If room equals ____>global.key_lev_=1
global.lev_keys+=1
Destroy Key

Collision with door

if place_meeting(-5,-5,Door)
or place_meeting(5,5,Door)
{
if global.lev_keys>0
{
with(Door) instance_destroy()
global.lev_keys-=1
global.lev_key_=1/True
}
}
else
{
with(Hero) hspeed=0 vspeed=0
}


Key

Room start

if global.key_lev_=1>Destroy self

Door

Room start

if global.lev_key_=1>Destroy self

Collision with Hero

if place_meeting(-5,-5,Hero)
or place_meeting(5,5,Hero)
{
if global.lev_keys>0
{
with(Door) instance_destroy()
with(Hero) global.lev_keys-=1
with(Hero) global.lev_key_=1/True
}
}
else
{
with(Hero) hspeed=0 vspeed=0
}


Step

if place_meeting(x,y+5,Hero)
{
with(Hero) if global.keylev1>0
{
with(Door) instance_destroy()
with(Hero) global.lev_keys-=1
with(Hero) global.lev_key=1
}
}
else
{
with(Hero) hspeed=0 vspeed=0
}

Hope this helps. Tell me if it doesn't.
Logged
  • Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #2 on: August 11, 2006, 05:38:46 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 51
Hey
Thanks for all the great codes Laigonaz but I???m SO confused. I know a little about codes but that just blew my mind is there a simple version or an engine that can help me a little more, thanks for all of ur help and i will definitely credit  u if you make it simpler for a idiot like me to understand.
Thanks a lot
~CJ
Logged
~CJ






King Tetiro

Leader of Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #3 on: August 11, 2006, 05:48:33 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
What bits don't you understand?

Quote
If room equals ____>global.key_lev_=1
-This is drag and drop.
Quote
Destroy Key
-And this
Quote
Destroy Self
-And this
Quote
Destroy Self
-And this

The rest is code.
Logged
  • Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #4 on: August 11, 2006, 05:57:59 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 51
Hey
I kinda get it, thanks for all of your help i will credit when my game is done.
Thanks again
Logged
~CJ






King Tetiro

Leader of Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #5 on: August 11, 2006, 06:03:06 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
No probs. Remeber to credit Moree too. He helped.
Logged
  • Phoenix Heart

Fox

Turnbeutelvergesser since 1988.
Re: Zelda Keys and locked doors example.
« Reply #6 on: August 11, 2006, 10:05:49 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 4062
No offense, but if that is already a problem for you to understand, then you should learn GML a bit more, or you won't stand a chance making a Zelda-game. Sorry, but that's the way it is. :(
Logged
  • Me on deviantART
Re: Zelda Keys and locked doors example.
« Reply #7 on: August 11, 2006, 01:30:26 pm »
  • Credits to BaB
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Posts: 807
No offense, but if that is already a problem for you to understand, then you should learn GML a bit more, or you won't stand a chance making a Zelda-game. Sorry, but that's the way it is. :(

Reminds me, when you first started Lights Of The Past, you basically did a melting pot of GM engines you found on the net :D

You should really start learning GML, I have a GREAT offline tutorial, made by Jelleye, I'd give it to you, but I need a good host :D
Logged

King Tetiro

Leader of Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #8 on: August 11, 2006, 01:32:42 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Who are you talking to? I don't know who.
Logged
  • Phoenix Heart
Re: Zelda Keys and locked doors example.
« Reply #9 on: August 11, 2006, 03:45:44 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 51
Hi
Where can i find this GML thing.
Thanks
Logged
~CJ






Re: Zelda Keys and locked doors example.
« Reply #10 on: August 24, 2006, 02:26:31 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
It's very simple, Jetsvaoe. Create a locked door object, and check if you have a key in the inventory. You should be keeping track of your number of keys in the current dungeon in a global variable. If you have a key, destroy the door object (or rather, make it open by just changing its position), and reduce the number of keys by one. Otherwise, don't open the door.

Here is some pseudocode:

Code: [Select]
repeat(global.small_keys > 0) { instance_destroy(); global.small_keys -= 1;}
« Last Edit: August 24, 2006, 02:28:04 am by Scooternew »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.339 seconds with 59 queries.