When creating new objects, variables start at 0

Just started using Construct 2? Post your questions here

Post » Fri Mar 14, 2014 5:49 am

I have an RPG where the player fights enemies (duh). When the enemy is defeated, the player gets its gold and XP, and then the enemy is deleted. Immediately after, a new enemy is created. The new enemy has (I believe) exactly 0 health, even if I change its health variable after creating it, but it should start out with 20. I have the free version of Construct 2, if that makes a difference.

Off-topic: where are the rules? I couldn't find them.
B
3
Posts: 3
Reputation: 181

Post » Fri Mar 14, 2014 7:36 am

Can you provide us some code?
Maybe c2 still has reference from old enemy?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Fri Mar 14, 2014 5:35 pm

Turns out I left some code in that deleted the enemy's health bar.

I feel so stupid.

Anyway, mods can lock this.
B
3
Posts: 3
Reputation: 181

Post » Sat Mar 15, 2014 6:17 pm

:) This is just normal. Even professional programmers do this sometimes, so don't feel stupid!
B
14
S
3
G
1
Posts: 255
Reputation: 2,027


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests