Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Adding level score

Author
Message
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Feb 2022 02:41 Edited at: 13th Feb 2022 04:07
Here is my problem, probably easy but a brain teaser for me.

I need a level score not a totals score. each level earns a star to light up if you achieve a score to that amount. I have it working fine but for game score not level score.

Some how I need to assign each level select image as its own level and score.

Here is what I am doing.

See if your score is whatever all the images for every level light up with the same frame . I thought about doing a level array but already am making the images with there own array.




The only way i can figure this out was a long way. adding them for 20 levels

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 13th Feb 2022 13:01
Remove the numbers in square brackets, replace them with a variable then encase it in a for loop using that variable.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Feb 2022 19:58
Quote: "Remove the numbers in square brackets, replace them with a variable then encase it in a for loop using that variable."


I did this and it gave me errors and also made them all do the same thing.

So I guess this works.

I created a level score empty array then mixed this with each sprite.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 13th Feb 2022 20:22 Edited at: 13th Feb 2022 20:26
Quote: "I did this"

Great!
Quote: "and it gave me errors and also made them all do the same thing"

In that case you didn't do it, you did something else.

Whenever you have repeating code where the only difference is an incremental number, the solution is clear. Make the number a variable and put the code in a loop. As I suggested above.

Login to post a reply

Server time is: 2024-04-16 10:31:31
Your offset time is: 2024-04-16 10:31:31