Loop Inside Function Issues

Get help using Construct 2

Post » Sat Aug 03, 2013 5:33 am

The goal is to have the computer spawn programs after the player spawns programs.

Player spawning is working 100% perfectly, computer spawning is not working at all.



BoardGame.capx
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sat Aug 03, 2013 6:04 am

I'd say it's time to add some logging. Add the Browser plugin and add some Log lines in appropriate places to see the flow. It seems like you are calling a lot of the logic too many times, not controlling your states appropriately. I prefer Chrome for logging. Hit F12 to bring up the console.
ImageImageImage
B
71
S
22
G
257
Posts: 3,790
Reputation: 142,696

Post » Sat Aug 03, 2013 6:10 am

I gave it a try.

But here's what my console aid at the start of execution and the end of execution:

[QUOTE]Viewport target-densitydpi is not supported. localhost:50001/:11
Using WebGL renderer preview_prelude.js:39
Shader '<default>' log: (empty) preview_prelude.js:39
Shader '<point>' log: (empty) preview_prelude.js:39
Max texture size: 16384 preview_prelude.js:39
WebGL Extensions: WEBKIT_EXT_texture_filter_anisotropic,OES_element_index_uint,OES_standard_derivatives,OES_texture_float,OES_vertex_array_object,WEBKIT_WEBGL_compressed_texture_s3tc,WEBKIT_WEBGL_depth_texture,WEBGL_lose_context preview_prelude.js:39
Point size range: 1 to 256 preview_prelude.js:39
[/QUOTE]

It didn't change during runtime so I'm not sure what the issue is.

I agree my code above is redundant, but the reason why I split it like that was to further test and try to debug.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sat Aug 03, 2013 7:00 am

You need to add your own log lines so you can "watch" what is going on, and see which code is running and which isn't. Print out variables, etc to see if they are the right values.
ImageImageImage
B
71
S
22
G
257
Posts: 3,790
Reputation: 142,696

Post » Sat Aug 03, 2013 10:52 am

This is when I really wish C2 had a step-through debugger :(
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234

Post » Sat Aug 03, 2013 10:10 pm

After further testing, I think the loop isn't working as intended. I could be wrong, but we'll see.

Any insight from anyone who has done automated spawning for a fixed number of times before would be grateful.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,234


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests