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: Is this possible?  (Read 981 times)

0 Members and 1 Guest are viewing this topic.

Zhello

N.A.D.I.
Is this possible?
« on: March 21, 2009, 09:44:16 pm »
  • L'homme avec beaucoup de noms.
  • *
  • Reputation: +6/-1
  • Offline Offline
  • Gender: Male
  • Posts: 925
This goes for obj which are rocks,bushes, and pots...Is there a code for this obj; making able to be breakable, and or picked up by player?

Also is there one for picking up small enemies and damage them if they are thrown? :huh: :huh:


plz answer
Logged
The IT Guy
Intermediate Coder
Linux is a wonderful thing
~Linkwolf48/Gumstone1080~

The Legend of Zelda - New Beginnings

http://zfgc.com/forum/index.php?topic=34986.0
1.6 Demo -
https://www.dropbox.com/s/56km0iadaras56g/LoZNB%20Game%20Folder.rar?dl=0


Side Projects:

Dragon Diary - Cybernetic Threat
Story: http://wiki.zfgc.com/Cybernetic_Threat

Quote
Aero88
ZFGC is like the Hotel California.  You can come in but you can never leave!

devianart: http://linkwolf48.deviantart.com/
Re: Is this possible?
« Reply #1 on: March 21, 2009, 10:32:27 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
For which language do you want to know.

What I would do is make boolean value representing what you want. And when you perform an action which requires this knowledge you can check it.
Logged
Re: Is this possible?
« Reply #2 on: March 21, 2009, 10:50:49 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
(I'll suppose you're making a zelda game using game maker)
Of course it is possible, you just have to add variables to define these states:

//"create" event of the object:
status = "normal"; //or "broken", "thrown", etc.
HP=100;
(etc...)


So when you break a pot for instance you do:

//when breaking the pot, for instance, in the collision event of pot for a collision between pot and link when link is using the sword:
if(link.status=="using_sword")
{
  status="breaking";
  sprite=pot_breaking; //use a sprite that doesn't loop its animation
}

//"animation end" event of pot
if(sprite==pot_breaking)
{
  sprite=pot_broken;
  status="broken";
}


When you pick up an object you can check if there is a collision when you're pressing the key for picking up and use a variable to refer to this object:
object_picked_up=other.ID;
(object_picked_up).status="picked up";
link.status="picking up";

Whenever you move link you have to check if link is picking up something and move that object setting (object_picked_up).x and (object_picked_up).y relatively to link.x and link.y.

And when you throw you do:
(object_picked_up).status="thrown";
link.status="normal";
(object_picked_up).hspeed=8;//or another value, depends on link's direction and how you're implementing your game, gravity, etc..
(object_picked_up).vspeed=0;
« Last Edit: March 21, 2009, 10:53:06 pm by sjegtp »
Logged
Pages: [1]   Go Up

 


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



Page created in 0.053 seconds with 40 queries.

anything