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 / What am I doing wrong here?

Author
Message
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 10th Apr 2014 19:07
Hi!

I've been staring at and re-writing this ****** code for what seems like eternity. I really don't understand why this does not work as intented.

Some background: When the player has completed the level (level identifier stored in
) and are returning to the main screen I have this code running:


What this is supposed to do is set a value in the file "save.data" corresponding to the level. This value can be:


First I run a quick loop through all the levels and get the status of each of the levels. (Level_Max = How many levels there are)

Then what I do is call:
This basically checks if the amount of coins you collected = possible amount of coins. This code works... Tested.

After that, if you collected all the coins, I change the status of the level to 0/1/2 depending on what the status was before. If it was unlocked then it is set to 2 (star), if it was 2 then it remains 2.

If you didn't collect all the coins and it was unlocked it remains unlocked... If it had a star, it keeps the star.

Then I check if the level after the current level (level_loader + 1) is unlocked, if it isnt, i unlock it.

Finally I save the lot and update it.

This works on level 1. Level 2 is unlocked and all that stuff...
However, when I try level 2... The status is never changed to 2 and level 3 is never unlocked???

Hope I've explained good enough! xD

Thanks!

PS: All the variables:
behave as they should.

cheers

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 10th Apr 2014 21:01
NEVERMIND!

Must have been overcomplicating things... I ended up sorting it out. What I think I was doing wrong was that a variable wasnt being saved for all the levels... which meant that they "staggered" and swapped places.

Fixed it... If anyone is interested here's my code now


cheers

Login to post a reply

Server time is: 2024-11-25 04:29:29
Your offset time is: 2024-11-25 04:29:29