Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!

Join the forum, it's quick and easy

Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com

Easy Gravity and Good Healthbars

+3
CarnivorousA
3d
Elmzran
7 posters

Go down

Easy Gravity and Good Healthbars Empty Easy Gravity and Good Healthbars

Post by Elmzran Fri Jul 10, 2009 11:28 am

I went on the GMC and found a list of a bunch of awesome codes that work wonders.
Here's a code for Easy yet Good Gravity for Platformers:

1. Easy gravity (platformers)

Code:
if !instance_place(x,y+1,obj_Solid)
gravity=0.5
if instance_place(x,y+1,obj_Solid)
gravity=0
if vspeed>10
vspeed=10

This code helps because it creates gravity ONLY if there is space under you that doesn't have a solid object. It also limits your vertical speed which helps with falling through floor bugs. Lowering the number helps more but may make it look less realistic. Try using different limit amounts. Change obj_Solid to whatever object you use for your ground. It can be a parent object if you use more then 1 for your ground objects.


And here's some awesome code for a Good Healthbar.

Good Healthbar

Code:
//DRAW:
draw_set_color(c_red)
draw_line(x,y-10,x+linelength,y-10)
if hpamount > hpmax hpamount = hpmax
if hpamount < 0 hpamount = 0

//STEP:
linelength= hpamount / hpmax * sprite_width
I've been asked many time on how to make a healthbar and many times the person wants it to only be so long even if it's a lot of HP. (just goes down slower...etc) Well this code does it all. This one uses a line which is smaller and cleaner looking rather then a rectangle. Just set hpamount, hpmax, and make sure linelength=0 is in create. Also be sure to put the first part of the code in draw and the second part in step. You can mess with the numbers like the 10s for the height (raise number to raise bar). Now you can set any objects health and not worry about line lengths! Very Happy
Elmzran
Elmzran
Admin
Admin

Posts : 115
Points : 54556
GameML Reputation : 2
Join date : 2009-06-13
Location : Tasty Ham World!

http://www.tastyhamgames.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by 3d Fri Jul 10, 2009 11:39 am

thanks for moving it.
3d
3d
Admin
Admin

Posts : 1227
Points : 66246
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by CarnivorousA Fri Jul 10, 2009 7:37 pm

I've got an easier healthbar code that works for individual objects.
Code:
draw_healthbar(self.x,self.y-4,self.x+31,self.y,hp*10,c_red,c_lime,c_lime,0,true,true)

Make a hp variable in the create event, in this code the default hp is 10, so it says hp*10 so it's 100. Change this. If you have a hp of 100 get rid of the *10, if you have a hp of 50 make it *2 etc, so it's 100.
CarnivorousA
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 56462
GameML Reputation : 17
Join date : 2009-06-01
Age : 29
Location : At the bottom of the lake.

http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by 3d Fri Jul 10, 2009 7:40 pm

cool!
3d
3d
Admin
Admin

Posts : 1227
Points : 66246
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Elmzran Fri Jul 10, 2009 9:19 pm

Yeah, the health bar code I posted was for the Player's Health bar. But there both awesome.
Elmzran
Elmzran
Admin
Admin

Posts : 115
Points : 54556
GameML Reputation : 2
Join date : 2009-06-13
Location : Tasty Ham World!

http://www.tastyhamgames.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by CarnivorousA Sat Jul 11, 2009 3:01 am

After so long, I try and try to get individual healthbars to work, and I find out you can do it with one line of code. I was both annoyed and glad.
CarnivorousA
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 56462
GameML Reputation : 17
Join date : 2009-06-01
Age : 29
Location : At the bottom of the lake.

http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by 3d Sat Jul 11, 2009 8:11 am

Ive never needed healthbars, although i may use this. Any codes for 3d health bars?
3d
3d
Admin
Admin

Posts : 1227
Points : 66246
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by CarnivorousA Sat Jul 11, 2009 8:51 pm

Would it not be the same?
CarnivorousA
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 56462
GameML Reputation : 17
Join date : 2009-06-01
Age : 29
Location : At the bottom of the lake.

http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by the sivart Tue Jul 14, 2009 6:26 pm

you should try doing that in 3d Smile
the sivart
the sivart
GameML Noob
GameML Noob

Posts : 3
Points : 54095
GameML Reputation : 1
Join date : 2009-07-14

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by CarnivorousA Tue Jul 14, 2009 7:56 pm

I can type everything I know about 3d in one post.
Code:
d3d_start()
d3d_end()
How will I know how to make healthbars in 3d?
CarnivorousA
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 56462
GameML Reputation : 17
Join date : 2009-06-01
Age : 29
Location : At the bottom of the lake.

http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by The Dark Ninja Thu Aug 13, 2009 11:56 pm

do you mean like a 3d box for the health bar 3d
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 57024
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by gogame1315 Fri Aug 14, 2009 9:57 pm

wouldn't you just use the code
Code:
{
  d3d_set_projection_ortho(0,0,640,480,0);
  d3d_set_hidden(false);
  draw_healthbar(x1,y1,x2,y2,health,c_black,c_red,c_lime,0,true,true);
  d3d_set_hidden(true);

}
???
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56275
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Sparx the Cy-Wolf Tue Aug 25, 2009 2:02 pm

Is it possible to create two separate health bars for two different objects at the top of the screen, you know like street fighter?

By the way Elmzran, I tried using the codes for the health bar and it did work to some degree, it's just the actual sprite for the object disappears.
I know it may have something to do with the DRAW event but I just don't know what!
Sparx the Cy-Wolf
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 56365
GameML Reputation : 5
Join date : 2009-06-07
Age : 33
Location : Mother ship

http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Sparx the Cy-Wolf Thu Aug 27, 2009 1:10 am

Actually no it's ok, I managed to figure it out for myself.
Try my new game to see for yourself.
Sparx the Cy-Wolf
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 56365
GameML Reputation : 5
Join date : 2009-06-07
Age : 33
Location : Mother ship

http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by CarnivorousA Fri Aug 28, 2009 6:18 am

Sparx the Cy-Wolf wrote:I tried using the codes for the health bar and it did work to some degree, it's just the actual sprite for the object disappears.
I know it may have something to do with the DRAW event but I just don't know what!
If an objct has a draw event it won't draw itself, you have to tell it to.
CarnivorousA
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 56462
GameML Reputation : 17
Join date : 2009-06-01
Age : 29
Location : At the bottom of the lake.

http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Sparx the Cy-Wolf Fri Aug 28, 2009 1:47 pm

So in otherwords, in the create event the first action should be to draw the sprite of the object....right?
(I suck at code)
Sparx the Cy-Wolf
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 56365
GameML Reputation : 5
Join date : 2009-06-07
Age : 33
Location : Mother ship

http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by The Dark Ninja Fri Aug 28, 2009 2:14 pm

go away i am back
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 57024
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Sparx the Cy-Wolf Fri Aug 28, 2009 2:21 pm

Oh my god puppy's back!
Sparx the Cy-Wolf
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 56365
GameML Reputation : 5
Join date : 2009-06-07
Age : 33
Location : Mother ship

http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Easy Gravity and Good Healthbars Empty Re: Easy Gravity and Good Healthbars

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum