2 questions (platform)

For questions about using Classic.

Post » Sun Dec 21, 2008 4:42 am

First and most importantly, what command do I give to make a sprite follow my player (I want it to walk up to me and start punching.) I've tried multiple things but I cant seem to get it to follow me properly (it's a platform game by the way.)

Secondly, if I wanted to have a health bar visible, would I have to create a sprite of each possible health amount (full health, half health, no health, etc.) and just have Construct replace the health bar each time the character is hit while reducing private variable points? Is there an easier method?

Any help is appreciated.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Sun Dec 21, 2008 12:40 pm

Here's a small example that shows how to make simple health bar and very simple follower:
http://www.mediafire.com/?m3dizm1jezi
B
2
S
1
G
4
Posts: 71
Reputation: 1,342

Post » Sun Dec 21, 2008 12:46 pm

With regard to a health bar you have two choices:

1. Make a sprite with the action spot at the left, then decrease the width (so if it was 200 pixels wide, you could just subtract 2 for every health point gone).

2. Make an animated sprite and set the frame manually.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun Dec 21, 2008 12:54 pm

Or, if your health bar is going to have some kind of patterns/images that you don't want to be squeezed by shrinking the sprite, you can make it on its own layer and make another sprite with erase effect to limit how large part of the bar is visible.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Sun Dec 21, 2008 12:57 pm

If that's the case, the tiled background object has a set width so you can safely set the width without ruining the image.

However if it's a full image Drasa's erase solution is the way to go.

Let us know what you're planning :).
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun Dec 21, 2008 9:27 pm

Thanks a lot for the tips. I'm going to try the tiled background method & see how it looks.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Sun Dec 21, 2008 9:34 pm

In my Platform School tutorial, starting with lesson two, there's a health bar of hearts up in the HUD. They're set up like Rich described for a reason... when it comes time for adding or reducing health all you have to do is + or - 32 pixels from the width of the health bar ;)

Or

[code:2ydtzvlw]
+Always
-> healthBar: Set width to global('playerHealth')*32
[/code:2ydtzvlw]

But that's going in a future tutorial :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Dec 21, 2008 9:44 pm

There is another issue that I need help with also. I have 2 private variables (health & mana.) My "mana" is set to regenerate +1 every 1 second. Let me explain the problem... ok lets say I set "c" to subtract 20 mana from the player and the player has 20 mana TOTAL. If I use "c" it makes the player reach zero mana BUT if I use it AGAIN the player goes to NEGATIVE 20 and if used AGAIN it goes to NEGATIVE 40 and so on. How do I set mana to NOT DECREASE if the player does not have enough to use?
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Sun Dec 21, 2008 9:50 pm

[quote="deadeye":3ca6p33m]In my Platform School tutorial, starting with lesson two, there's a health bar of hearts up in the HUD. They're set up like Rich described for a reason... when it comes time for adding or reducing health all you have to do is + or - 32 pixels from the width of the health bar ;)

Or

[code:3ca6p33m]
+Always
-> healthBar: Set width to global('playerHealth')*32
[/code:3ca6p33m]

But that's going in a future tutorial :P[/quote:3ca6p33m]

Yea I saw your platform school tutorial. Its explained EXTREMELY well. Now that I understand the health bar its simple :D thanks.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Sun Dec 21, 2008 10:10 pm

In the event where the subtracting happens, "'c' is pressed" or something like that, you must add an additional condition to test whether you have enough mana! For skill requiring 20 mana, click "insert new condition" on the menu in event editor and test if private variable 'mana' is 20 or greater.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests