Hey guys. I'm running into a few issues regarding how healthbars work in GM.
Essentially, I want my health bar to have as many units as the number of enemies still alive in the round. That is, when an enemy dies, the healthbar shrinks.
I have all the variables set up and the bar drawn how I want it, but as the bar works in percentages it shrinks to an appropriate size for, say, 27 enemies. The bar length is 27% percent.
So my question is: how can I make the bar the bar start at the length of a certain variable count, not at a percentage, and then shrink accordingly?
Thanks.
- Game Maker Community
- → Viewing Profile: Topics: Maelbox
Maelbox
Member Since 09 Jun 2010Offline Last Active Jun 09 2012 12:19 PM
Community Stats
- Group New Member
- Active Posts 29
- Profile Views 1262
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
none
Topics I've Started
Healthbar Relativity
16 May 2012 - 10:21 AM
Locking image angle of object to another object's
24 February 2012 - 02:09 AM
I know that I can use image_angle = other_object.image_angle, which I do now, but I'm running into problems when I need it to change independently while staying relative to the main objects own image angle.
The two objects are the rudder and sail of a ship. They both match the ships image_angle, but rotate additionally from there.

I know this is probably a pretty simple thing to do, but I'm just getting really confused with the math of the code. Can anyone please help?
The two objects are the rudder and sail of a ship. They both match the ships image_angle, but rotate additionally from there.

I know this is probably a pretty simple thing to do, but I'm just getting really confused with the math of the code. Can anyone please help?
Relocating multiple instances of the same object
21 February 2012 - 05:25 AM
I am struggling with working with more than one instance of the same object.
Essentially, I have a main ship object that, when spawned, has a certain number of guns it can carry. These guns are one instance, but are recreated over and over until no more need to be created.
The issue is locating them on the ship itself. I have the coordinates, but when I try something like instance_number or object_index or id, it doesn't seem to want to return the number I want.
The code I'm trying to work out is to say that when the gun is spawned, it checks its ID against an IF statement in the create event and locates accordingly.
However the problem is this doesn't happen. The guns all seem to bunch to one of the possible coordinates, even when I have something like this set up:
The coordinates themselves aren't an issue as they are merely offsets that are referenced later in the gun step code.
Can anyone help?
Essentially, I have a main ship object that, when spawned, has a certain number of guns it can carry. These guns are one instance, but are recreated over and over until no more need to be created.
The issue is locating them on the ship itself. I have the coordinates, but when I try something like instance_number or object_index or id, it doesn't seem to want to return the number I want.
The code I'm trying to work out is to say that when the gun is spawned, it checks its ID against an IF statement in the create event and locates accordingly.
However the problem is this doesn't happen. The guns all seem to bunch to one of the possible coordinates, even when I have something like this set up:
if id == 1{
set gun at this coordinate
}
if id == 2{
set gun at this coordinate
}
if id ==3{
set gun at coordinates 3
}
etc. The coordinates themselves aren't an issue as they are merely offsets that are referenced later in the gun step code.
Can anyone help?
Attaching objects to other objects
20 February 2012 - 06:52 AM
x = object.x y = object.y
I know this code, as well as the lengthdir code and using an offset value, but none of them work for my purpose.

Essentially, I am trying to anchor my cannon objects onto a ship object, but I am struggling to do so. I always end with the cannon moving around in a strange circular pattern, especially when the two x and y locations are different.
I can get one cannon to set in its correct place, but I can't seem to find a way to set more cannons on the same side of the ship.
Can anyone help?
Request: Sword and Sword Animation - Top Down
08 December 2011 - 09:07 AM
Hey there!
I have most of my animations working and any more I can make myself, however I am stuck on the main animation: the sword swing. I have drawn a diagram to make it as easy as possible.

This is actual size. The red is the sword, the blob in the middle is the player and the arrows show the movement of the sword. I need a simple sword outline that is the same length as the red guide. I then need it to swing back along the grey arrow, then quickly forward along the orange arrow. I've tried to make this as easy as possible.
Help would be much appreciated, and of course your name will appear in the credits if chosen.
Edit: Also, all I need is the sword animation and the sword itself. The player does not need to be included.
I have most of my animations working and any more I can make myself, however I am stuck on the main animation: the sword swing. I have drawn a diagram to make it as easy as possible.

This is actual size. The red is the sword, the blob in the middle is the player and the arrows show the movement of the sword. I need a simple sword outline that is the same length as the red guide. I then need it to swing back along the grey arrow, then quickly forward along the orange arrow. I've tried to make this as easy as possible.
Help would be much appreciated, and of course your name will appear in the credits if chosen.
Edit: Also, all I need is the sword animation and the sword itself. The player does not need to be included.
- Game Maker Community
- → Viewing Profile: Topics: Maelbox
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content