Problem when picking family member for deletion

Get help using Construct 2

Post » Fri Dec 13, 2013 4:28 pm

wouldn't on bubble destroyed add one to counter work?

Or you could use
for each bubble
system compare two values: bubbles.lifetime < 0
- bubble destroy
- add 1 to missedbaubles
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 7:59 pm

I am just taking a wild guess at this. Do you have an off screen Baubles that you are spawning from? If so, then you have 2 Baubles after you spawn the new one. If there is an original Bauble off screen, then that may be the one that is being destroyed which leaves the new Baubles onscreen. Normally I have seen people use a On start of layout > destroy object to account for this type of problem.

When you change the code to Pick Baubles where Baubles.Lifttime < 0 you stated,

"When the first bauble is spawned the "Missed" counter is increased by 1 and the bauble is not deleted.   
After a few seconds it is deleted and the counter shows 2, but it should be 1."

That increased "Missed" to 1 might be the original and then the second spawned instance onscreen Baubles is destroyed "and the counter shows 2, but should be 1."
Try deactivating the "Spawning Baubles" and the "Despawning Baubles" groups, and then use the Debugger to track if any Baubles exist at the start of the layout. If there is one that exist, then your first Spawned Bauble is not the first Bauble picked and messing with your Vars and Conditions. Put a Keyboard when key X press then activate "Spawning Baubles" and check debugger again for all Var values # of Baubles and see if they are what you would expect. Then use another key press y to deactivate "Spawning Baubles" and activate "Despawning Baubles." Recheck Vars and # of Baubles to see if it is what your expected.

I have learned that all to often what I think is happening is not the true "State" or "Status" of my vars or objects and the Debugger quickly reveals where my logic is bad. You can step through each event/action process using the debugger to watch every element taking place when, why, and what happened as a result of each ACE of your Events Sheet. Learning how to use the debugger was the best thing I did to help me to fix and stop writing bad code and how to rethink my logic before writing the code. Yann stated in one of his video tutorials that when the problem is complex, we should write out our logic in English, in my case, what we are trying to accomplish before we start coding. That was the best advice ever. As a result, I bought high quality whiteboard paint and made my sliding closet doors into a 7'x7' brainstorming wall. My ability to get it right the first time or fined problems quicker made all the difference in how I code. Instead digging a deep and complex coding hole that I cannot find my way out of, I just pickup a dry erase pen and eraser and make changes to my logic in a matter of seconds. He suggested getting a small whiteboard which would work to help in developing your logic process first then code and test it. I just when big on the whiteboard because, as you can see my mind runs 100 miles and hour and I need lots of space to get my ideas out.

If you do not get the problem solve. Could you post your capx. I would love to see if I could help solve the problem, and also learn form your great ideas on how to create processes that I could study then modify to possibly use in my project development also.   Hope all works out for this problem and that maybe you could post the solution for the rest of us to learn from. Thanks.EmpowerMe2013-12-13 20:48:13
B
70
S
9
G
8
Posts: 24
Reputation: 8,736

Post » Fri Dec 13, 2013 10:06 pm

Thank you very much to both of you.

It's too late to test it now but I think you might be right about the additional objects. I have a few baubles placed on the outside (need to have them there to spawn them?) and forgot to add a "Destroy on Startup" command (which I learned a few weeks ago but totally forgot about). I will take a closer look at the debugger and try to incorporate your suggestions. Writing down the logic of what you want to do is a very good idea. I will try it again tomorrow.

Thanks for the detailed advices!
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
16
G
6
Posts: 744
Reputation: 9,312

Post » Sat Dec 14, 2013 1:20 pm

Hi. Seems you were right. I hade multiple baubles on the layout and one of them was counted as missed right at the beginning. I added a Destroy command on Startup and it seems to have fixed it. No 1/10 missed at the beginning.

Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
16
G
6
Posts: 744
Reputation: 9,312

Previous

Return to How do I....?

Who is online

Users browsing this forum: batto and 27 guests