Object Not Destroying

Get help using Construct 2

Post » Wed Jun 18, 2014 2:04 pm

Hello,

I have an object (pedestrian). It has an instance variable (scale) that starts off as 0.2, and increases by 0.001 every tick. Naturally, the objects literal scale is assigned to this variable during every tick.

When scale reaches 1.0, I want the object to be destroyed.

However, it's not getting destroyed. It just keeps growing. Does anybody know why? Thanks.
B
9
S
2
Posts: 26
Reputation: 807

Post » Wed Jun 18, 2014 2:18 pm

Check for >= 1.0. Computer math with decimals is rarely exact. This has been discussed many times. It's possible your value is 1.000000001 or something like that, so checking for a specific decimal number can fail.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Wed Jun 18, 2014 2:27 pm

I think you are using "equal", You need to use "greater or equal".
Check this file :
You do not have the required permissions to view the files attached to this post.
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Thu Jul 03, 2014 5:50 pm

Thanks, that worked :)
B
9
S
2
Posts: 26
Reputation: 807


Return to How do I....?

Who is online

Users browsing this forum: newday198913, Yahoo [Bot] and 11 guests