Jump to content


Photo

Game Maker Enemy Health Problem


  • Please log in to reply
15 replies to this topic

#1 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 26 September 2008 - 06:29 PM

Ic have a Problem. I dont know how to make Enemy Health. I make a scrooling shooter Game. I know how to make Health for my Charakter, but i dont know how to make Health for an enemy. (I use Game Maker 7.0 Lite)

Can somebody help me? I cannot god english. But i can german!

please help!

Edited by -LEWA-, 26 September 2008 - 06:32 PM.

  • 0

#2 desertdweller

desertdweller

    Love Truth

  • New Member
  • 1255 posts

Posted 26 September 2008 - 06:41 PM

Okay. What you need to do is define a variable "hp", meaning health, and a variable "hpmax", meaning maximum health. (in the GameMaker health this is by default 100)

Each object defines those variables, and when an enemy loses health, only make the hp decrease accordingly. You now have two variables, hp and hpmax, which are equivalent to the GameMaker health and 100.

So you can German? I can Spanish! [ :rolleyes: ]
  • 0

#3 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 26 September 2008 - 06:44 PM

Can definite it better? (Sorry for it but, i am new. I cannot use Variable so god...) :rolleyes:

I dont now how to do this. How make it in Game maker?

Set Variable? Test Variable? In create or in Step Event? How do this?

Edited by -LEWA-, 26 September 2008 - 06:45 PM.

  • 0

#4 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3471 posts
  • Version:GM:Studio

Posted 26 September 2008 - 06:54 PM

i guess youre using the drag & drop options, ill see if i remember how where they used xD
use "set variable" and set the variable "hp" to 100, do the same for "hpmax"

then draw a healthbar with thoose values

everytime your ememy gets hit, use the "set variable", with variable "hp -= 20" (change 20 for the value you like)

i havent checked if it works, i dont use the d&d since like 3 years ago
  • 0

#5 slayer 64

slayer 64

    GMC Member

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

Posted 26 September 2008 - 06:54 PM

look at my example...

http://host-a.net/sl... AI example.zip
  • 0

#6 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 26 September 2008 - 06:56 PM

Sorry for that question, but how i do HP max? I know how to do Variables. But HP max???

(I´m very new...)
  • 0

#7 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3471 posts
  • Version:GM:Studio

Posted 26 September 2008 - 06:58 PM

write "hpmax" as the variable in the "set variable" settings (was it like that? plase help if im messing up this guys mind xD)
  • 0

#8 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 26 September 2008 - 07:02 PM

@ slayer64 : Thank you, but there are no Health Options....


@ manuel777: Where must i take it in??? (Its so OK to say?) In Step event, or in Create event? An should i take HP and HP max in the same event?

Please help! The Problem is, that when i make the Variable health, (value: 100, no relative) and Collision with shoot object (Variable: health ,value: -100 no relative) An i test the game, the health wouldn´t decrease from the enemy, but it wouldt decrease from my Charakter! but it must be decrease from the enemy!

please help!

Edited by KC LC, 27 September 2008 - 12:16 PM.

  • 0

#9 karzahnii

karzahnii

    GMC Member

  • New Member
  • 545 posts

Posted 26 September 2008 - 08:22 PM

You can't use 'health'. 'health' is a built in variable that's used by all objects, since it's global. Instead, you want to make your enemy have its OWN health.

In the create event of the enemy, use a code like
myhealth = 100;

And use the variable 'myhealth' over 'health'. And when the enemy collides with a bullet, use something like
myhealth -= 25

That way, only the monster's health decreases since its variable is local.
  • 0

#10 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 26 September 2008 - 09:07 PM

Thanks but myhealth doesn´t works! There comes a failure!

Something with ``Unknown Variable myhealth´´.

And ``myhealth -´´ also doesnt works. Can something make an example?

Edited by -LEWA-, 26 September 2008 - 09:08 PM.

  • 0

#11 Abyssal_Nuclei

Abyssal_Nuclei

    GMC Member

  • GMC Member
  • 1695 posts

Posted 26 September 2008 - 09:47 PM

If you are getting an unknown variable error, it means that the variable wasn't initialized.

What object got the error? What is the code in the create event of that object? What is the code in the event in which the error occured?

See if the variable that GM is having a problem with was initialized in the create event of that object.


~Abyss
  • 0

#12 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM:Studio

Posted 27 September 2008 - 11:42 AM

can somebody make an example in Game Maker? I am a little bit worried.
  • 0

#13 Abyssal_Nuclei

Abyssal_Nuclei

    GMC Member

  • GMC Member
  • 1695 posts

Posted 27 September 2008 - 05:00 PM

Did you see my reply? You have reason to be worried if you don't want to take the time to troubleshoot your own game.


~Abyss
  • 0

#14 wargamer

wargamer

    GMC Member

  • New Member
  • 25 posts

Posted 03 December 2008 - 10:07 PM

Ic have a Problem. I dont know how to make Enemy Health. I make a scrooling shooter Game. I know how to make Health for my Charakter, but i dont know how to make Health for an enemy. (I use Game Maker 7.0 Lite)

Can somebody help me? I cannot god english. But i can german!

please help!


here is german translating hope it helps!! ohh go to translate.google.com it will help you translate english into german it helps alot!

Okay. Was Sie tun müssen, ist eine Variable "PS", was bedeutet, Gesundheit, und eine Variable "hpmax", was bedeutet, dass maximale Gesundheit. (in der GameMaker Gesundheit Dies ist standardmäßig 100)

Jedes Objekt definiert, die Variablen, und wenn ein Feind verliert Gesundheit, nur die PS entsprechend abnehmen. Sie haben nun zwei Variablen, PS und hpmax, die den GameMaker Gesundheit und 100.
  • 0

#15 gm_tuts

gm_tuts

    GMC Member

  • New Member
  • 34 posts

Posted 26 January 2009 - 04:33 PM

Download this:
http://willhostforfo...ad&fileid=49112
it is well commented.
  • 0

#16 ricky.sanchez@hotmail.com

ricky.sanchez@hotmail.com

    GMC Member

  • New Member
  • 2 posts

Posted 04 May 2009 - 09:39 PM

ENGLISH

1. In the object enemy, put a create a event put a variable named HEALTH, give it a value of 100.
2. In the object enemy, put a collision event with the bullet(or the object that will kill the enemy);
3. (In collision event with bullet) Start a block, set a variable named HEALTH (value= -50(Relative)), set destroy instance (applies to = other), End block.
Start Block, Test Variable (variable = HEALTH(value = 0 (Operation = equal to))), Destroy Instance (applies to = self)

That worked with me.

if you have a problem feel free to ask a question.

GERMAN

1. In der Objekt-Feind, stellen eine Erstellen eines Ereignisses, stellen eine Variable mit Namen HEALTH gib einen Wert von 100.

2. Bei den Feind Objekt setzen Sie ein Ereignis Kollision mit den Aufzählungszeichen (oder das Objekt, das den Feind zu töten, wird);

3. (In Kollision Veranstaltung mit Aufzählungszeichen) Einen Block zu starten, legen Sie eine Variable mit Namen HEALTH (Wert = - 50(Relative)), Satz zerstören Instanz (gilt in = andere), End-Block.
Start Block, Test-Variable (Variable = HEALTH(value = 0 (Operation = equal to))), Destroy Instanz (gilt in = selbst), die mit mir zusammengearbeitet.

Wenn Sie ein Problem Gefühl frei, eine Frage haben.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users