problem with clamp

Get help using Construct 2

Post » Thu Jul 25, 2013 5:29 pm

hello everyone, my problem is that i spawned 2 enemy sprites in the layout and set the hp of the enemies to clamp between 0 and 10 but when you attack them the hp bar will decrease to a negative level i dont know why, also i have a problem with the hand selector after i create the two enemies y set the selector hand to an enemy but it wouldnt appear in the start of the layout, if you click an enemy it will appear.

here is my capx https://dl.dropboxusercontent.com/u/85479859/dabestgeim.capx

to attack you have to select an enemy and an attack and press battle

if someone could help me i would appreciate it, thanks
B
17
S
2
G
2
Posts: 82
Reputation: 1,712

Post » Thu Jul 25, 2013 6:10 pm

Just a quick look through your code I can see one problem.
You subtract 3 from the HP then immediately adjust the HP Bar accordingly.

However, you need to clamp the HP before adjusting the bar.
B
12
S
4
G
2
Posts: 59
Reputation: 3,779

Post » Thu Jul 25, 2013 6:14 pm

As for the hand selector. You should set the initial position to;

enemy.x and enemy.y - 100

instead of enemies.x and enemies.y - 100 (this is the entire family)
B
12
S
4
G
2
Posts: 59
Reputation: 3,779

Post » Thu Jul 25, 2013 6:29 pm

thanks!!! it works
B
17
S
2
G
2
Posts: 82
Reputation: 1,712


Return to How do I....?

Who is online

Users browsing this forum: Congrats2u, jhjconstruct, tarek2, TheGreatAdam12 and 8 guests