using sprites as a live meter

For questions about using Classic.

Post » Wed Jun 06, 2012 6:16 pm

Hello everyone
glad to ask again
my question this time is for anyone one that ever used game maker
can i use sprites as live meter or lives
if so can anyone fix the .cap for me
thank you in advance
ps:.CAP filegeniusrko2012-06-07 11:12:13
B
5
S
1
Posts: 20
Reputation: 590

Post » Thu Jun 07, 2012 1:13 pm

53 views without a single reply
B
5
S
1
Posts: 20
Reputation: 590

Post » Sat Jun 09, 2012 9:20 pm

It's just too basic in my opinion.
In short - yes, you can. Don't have Classic on pc atm
B
19
S
6
G
4
Posts: 171
Reputation: 2,507

Post » Sun Jun 10, 2012 1:03 am

well how about describing it even with construct 2
B
5
S
1
Posts: 20
Reputation: 590

Post » Sun Jun 10, 2012 1:34 am

hey, i added the life meter.
http://dl.dropbox.com/u/45834687/lifemeter.cap

i explained what i did and how it works in the event sheet.
i used a tiled background instead of a sprite,
it repeats vertically and horizontally, so you need to keep the height normal, and take the normal width, and multiply it by the number of lives.

at first i added a check to see if you had more than 0 lives, but at the end i dont think you need it, but i forgot to remove it.

what you need to do is make the plane respawn after dying.

i think it should work

if you have any questions let me know,
B
6
S
1
G
1
Posts: 52
Reputation: 858

Post » Sun Jun 10, 2012 2:00 am

I wish you look at it again whn the plane is destroyed and life count is 2
the tiledbackground disappeargeniusrko2012-06-10 02:15:52
B
5
S
1
Posts: 20
Reputation: 590

Post » Mon Jun 11, 2012 4:18 am

For me, I have a single sprite with multiple frames of animation (set to 0 speed so it doesn't animate.) Each frame number corresponds with a global variable for health/hit points. Ie if global variable "life" = 2, set sprite "hp" animation frame to 2, and so on. Very simple to set up, every thing is in a single object, no math involved. If the max healt is 3, it also helps to have an event where if glob.var "life" > 3 set "life" to 3 to make sure you avoid errors with health-restoring items.

Of course, this would be less effective with large bars ala Zelda, but there are more compact and creative ways to show health anyways C-72012-06-11 04:20:46
B
90
S
32
G
14
Posts: 935
Reputation: 14,540

Post » Mon Jun 11, 2012 2:26 pm

Thanks
B
5
S
1
Posts: 20
Reputation: 590

Post » Thu Jun 14, 2012 10:50 am

that is just because once the energy = 0, the life is lost
BUT you need to set energy = 100 for the new life!
or the counter will keep loosing lives if energy = 0,
so it will go: lives 3 -1, 2 -1, 1 -1, 0, and you will only see 3 -> 0

where it says "if the life counter is ON, lose 1 life, turn life counter OFF"
add: *set global variable 'energy' to 100*

but then what happens is, you lose a life,
the counter shows 2, and energy 100, but no plane!

because you destroyed the plane a forgot to create it again!

you can either spawn a new plane at XY, or just move it XY and not destroy it.
B
6
S
1
G
1
Posts: 52
Reputation: 858


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests