Getting Health Working?

Stuck? This is the place to go to get and give help.

Getting Health Working?

Postby djl12328 » February 9th, 2012, 2:19 am

I was working on a legend of zelda game for the DS (please note that this is my first game with ds game maker) and I ran into an issue with the health. I am using variables for the health called LinkH and DarkLinkH. I had it display the global variables but when I do something they never go down. I set them up so they should work. I think it might be a problem with the collision because even if a put just a go to a different room inside a collision it won't go to that room.

Thanks. :grin:
Attachments
Legend of Zelda.dsgm
.dsgm file for the legend of zelda
(4.83 MiB) Downloaded 19 times
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby djl12328 » February 17th, 2012, 3:03 am

Bump
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby memefefe » February 17th, 2012, 5:29 am

I didn't look at the DSGM yet but where did you put the display variable action? In a create event or a step event? Creat events only happen when the object is first created where as a step even happens like every 60th of a second so it keeps updating as you play the game.
Who doesnt wanna watch a weirdo tumble?
http://kawaiiweirdo.tumblr.com
memefefe
 
Posts: 952
Joined: August 19th, 2011, 3:35 am
Location: The infinite expanses of my mind

Re: Getting Health Working?

Postby djl12328 » February 17th, 2012, 3:07 pm

I just switched it and tried and it still wouldn't work. Also I added a create event and put set DarkLinkH to 100 in that instead of in the step event.

Edit: Also in order to run the game you might need the files a this link. viewtopic.php?f=6&t=2227
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby memefefe » February 17th, 2012, 7:29 pm

You put the display variable in the step event? It will display the 100 hp when you start but won't change? Hmm ill have a look at this later and tell ya what I find
Who doesnt wanna watch a weirdo tumble?
http://kawaiiweirdo.tumblr.com
memefefe
 
Posts: 952
Joined: August 19th, 2011, 3:35 am
Location: The infinite expanses of my mind

Re: Getting Health Working?

Postby djl12328 » February 18th, 2012, 12:50 am

Thanks, I await your reply.
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby djl12328 » February 25th, 2012, 10:57 pm

Bump
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby Foxi4 » February 26th, 2012, 12:36 am

"Health" is a very abstract unit. The best you can do is to prepare a global/non-global variable for the character and whenever "something" happens, decrease the value of this variable.

I know it sounds like black magic if you're new to programming, but just as an example, declare a global called "Health", give it a value, say, 100, and decrease from it whenever something (If statements) happens, ex. when you get hit by something (If collision with).

In step, when "Health is equal or less than 0" set a death scene - that's really the easiest way to manage this.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: Getting Health Working?

Postby djl12328 » February 26th, 2012, 2:06 am

But the problem is collisions are not working. Only a couple of collisions work and those were some of the first ones i made. Is there a "if collision" function I could use that might work?
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby Foxi4 » February 26th, 2012, 3:43 am

Oh c'mon - the collisions are based on ID's of sprites - all the collisions work, surely. Post the DSGM with non-functioning collisions, I'm eager to see the error.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: Getting Health Working?

Postby djl12328 » February 26th, 2012, 4:04 am

Ok. The collisions did not work for the bow, triforce, doors, or the orb (might be more I didnt name but those are off the top of my head) so I had to use "tap" instead. Anyway here is the file. Again you might need the files from the first post (they are in the link).

P.S. Ill also add the nds file for if you have compiling errors. Press B and the menu, then press A. That should bring you to a room so you can see what in talking about.
Attachments
Legend of Zelda.dsgm
(4.85 MiB) Downloaded 17 times
LOZ Pre-Alpha 0.032.nds
(1.34 MiB) Downloaded 18 times
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby djl12328 » March 1st, 2012, 8:09 pm

Bump
djl12328
 
Posts: 14
Joined: February 8th, 2012, 1:37 pm
Location: At my computer.

Re: Getting Health Working?

Postby Buck_7 » March 1st, 2012, 9:11 pm

If you want to lower dark link's health, make sure in the collision with dark link its:

If Pad.Newpress.B
Set Variable DarkLinkH to DarkLinkH - 20

Nothing hard about that.
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1002
Joined: February 19th, 2011, 1:44 am


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests