Score Keeps Going and Going and...

For questions about using Classic.

Post » Mon Jan 30, 2012 1:10 am

+ System: Is global variable 'Boss002' Less or equal 0
-> Boss002: Destroy
-> System: Add 500 to global variable 'Score'
-> System: Set global variable 'Mode' to 99

For some reason, once the first boss is killed, the score keeps climbing. Never stops. Killing the enemy ships is working fine. For example:

+ Enemy003: Value 'HitCounter' Greater or equal 1
-> Enemy003: Destroy
-> System: Add 300 to global variable 'Score'

The GLOBAL "score" is set up as:

+ System: Always (every tick)
-> Text_HealthIndicator: Set text to "Health: " & Hero ('Health')
-> Text_ScoreIndicator: Set text to "Score: " & global('Score')
-> Text_BooksIndicator: Set text to "Books: " & global('BookCount')

Once score hits 500 or more, that first boss comes. Once the ship is destroyed, the score continues on without stop.

Any thoughts on this? Need to see the CAP?

Thank you.
B
5
S
1
G
1
Posts: 157
Reputation: 1,219

Post » Mon Jan 30, 2012 1:15 am

Try 'trigger once'?
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

Post » Mon Jan 30, 2012 1:30 am

If the events posted above are complete, then there's an event/condition/trigger missing, that sets the global 'Boss002' to anything other than less or equal 0. Which means, as soon as that condition is met, it keeps being true on every tick.

One solution could be indeed using 'trigger once' with this event:
+ System: Is global variable 'Boss002' Less or equal 0
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Jan 30, 2012 2:52 am

Sorry, meant Boss001, not 002:

+ System: Is global variable 'Boss001' Less or equal 0 (Boss' HEALTH)
-> Boss001: Destroy
-> System: Set global variable 'Mode' to 99
-> System: Add 500 to global variable 'Score'

I moved the score action to my trigger event for the sound:

+ System: Trigger once
-> XAudio2: Autoplay resource "bigboom.wav" (No loop)
-> System: Add 500 to global variable 'Score'

Yes, that worked and the score not going on forever (assuming it does, I stopped it at 20,000,000 last time).

I must have done something, when fixing the global variables the other week, that caused the boss scores to not end.

It is working for now and see how it goes.

Thank you both very, very much.
B
5
S
1
G
1
Posts: 157
Reputation: 1,219


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests