Can't Get Score to Reset

Bugs will be moved here once resolved.

Post » Tue Apr 19, 2016 4:32 pm

I'm pretty sure this is my fault somehow, but if anyone can figure out the issue I would be eternally grateful! :?:

Problem Description
____ A concise description of your problem here ____ The Score is not resetting at the start of a new game

Attach a Capx
____ Upload a Capx to this post ____ https://drive.google.com/folderview?id= ... sp=sharing

Description of Capx
____ Concise description of what this CapX does ____

Steps to Reproduce Bug
  • Step 1 Shoot planes to gain a score above 0
  • Step 2 Get hit to generate the start screen then hit start
  • Step 3 check score, it should be reset to 0

Observed Result
____ What happens? ____ the score isn't reset, but continues from the last play

Expected Result
____ What do you expect to happen? ____ the score to reset to 0. There is an action that should reset the global variable of "Score" to "0"

Affected Browsers
  • Chrome: (YES/NO) YES
  • FireFox: (YES/NO) YES
  • Internet Explorer: (YES/NO) YES

Operating System and Service Pack
____ Your operating system and service pack ____ Windows 10/8

Construct 2 Version ID
____ Exact version ID of Construct 2 you're using ____ R227
B
5
Posts: 3
Reputation: 233

Post » Tue Apr 19, 2016 4:48 pm

https://www.scirra.com/manual/83/variables

Global variables store their values between layouts. Events in any layout can access any global variable, even if it was created in a different event sheet that is not included.

The meaning of 'global'

System has an action to reset globals.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Apr 19, 2016 4:52 pm

so are you saying I should use a local variable instead?
B
5
Posts: 3
Reputation: 233

Post » Tue Apr 19, 2016 4:57 pm

You could use a local or on start of layout, reset all global variables.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Tue Apr 19, 2016 4:57 pm

Set score to zero in the 'on touch event' on the starting layout and before you change layout.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Apr 19, 2016 8:25 pm

rekjl wrote:You could use a local or on start of layout, reset all global variables.



I went with the latter and it worked perfectly. Thank you so much! :D and thanks to 99Instances2Go
B
5
Posts: 3
Reputation: 233

Post » Wed Apr 20, 2016 12:26 pm

Closing as not a bug.
Scirra Founder
B
402
S
238
G
89
Posts: 24,632
Reputation: 196,031


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests