Trying to Make a Loop but Not Working

For questions about using Classic.

Post » Mon Feb 27, 2012 12:34 pm

There are two things I see up front.

The first is, You add 1 to the 'Shields' variable, instead of setting it to 1, when 'Bookcount' = 66. And You only set the Frame to 2, if 'Shields' = 1.
Why is this a problem? Well, if we think ahead. Then what will happen, if 'Shields' = 2? Which will happen, because You always add 1 to 'Shields' for each 66 Bookcounts. Of course right now nothing will happen if it's 2, but You never set back 'Shields' = 0.
And You say if 'Shields' = 0 -> Set Frame to 1.
Also the Sub-Event code for "Every 15000ms" will only run, if 'Shields' = 1.

The next things is, the short flash You see. Why? Think about it again. When do You set Frame = 1? If 'Shields' = 1 AND "Every 15000ms".
So this Tick let's assume 'Shields' = 1 AND "15000ms" have passed in this Tick. In this Tick Frame will be set back to 1. However the next Tick the 'Shields' = 1 Event will be checked again and what happens if 'Shields' = 1? Set Frame 2.

It can be maddeningly frustrating at times, but stick to it and with time You will get the hang of it. You know, every beginning is hard and all good things take time. It's also important to keep a cool head and try to keep a good overview and memory in Your head of the processes going on at all times, that might be related to other.
Posts: 70
Reputation: 765

Post » Wed Feb 29, 2012 5:31 pm

Shindoh, I believe I see the mistakes you pointed out.

23 is now (main, not a sub-event)

+ System: Every 15000 milliseconds

24 is now (sub of 23)

+ Hero: Value 'Shields' Equal to 1
-> Hero: Set 'Shields' to 0

So every 15000ms AND shields is 1, set shields back to 0.

That was it. Seems to work and shields last for 15s after books hits 66.

I see where I kept setting values incorrectly with ADD instead of SET.

Thank you.

Now, onto making the shields actually block things!
Posts: 157
Reputation: 1,219


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests