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.

DarkBASIC Professional Discussion / Intigers change back Switching levels=tip

Author
Message
gamehazer
1
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 21:38 Edited at: 5th Aug 2018 21:45
So I had to set up a Hugh array to be able to switch levels back and forth.


This is fine and works well, But I have to leave out some integers at the top of my code as when the level changes it resorts back to the original values to the next level.


So if my player health if 40 and the next level loads from the top of my code then my players health goes back to 100.

So I have learned to leave out what health equals or other values as a integer just to save the values to the next level change.

In this I have learned not every little thing needs to be recorded at the top of your loop and some things should be opted out unless called for.

Also I have to create two the three diffrent values just to keep some recorded information like a example bellow.

If level_section=0 then player_health=0

this will reset my health back to 100 only if level_section=0 but my players can swich back and forth from each level any time.

So I have to create a third value to stop it from changing, thats a lot of other values I dont need, Just to change levels.

Now I am using a saving system that works well.

So my point here is if you want to swich bck and forth from one level to the next and back you will have to use a saving sytem just for that reason.

Also there is another problem, if my player is in the loop, and your playing level 1 section 2, then only things in that level section can happen, so I have to record what level section is being played.

This is another three values I have to record.

Thats a lot to keep track of.

I need a array that holds all the information for all the sections of all the levels.

This is just a tip for any one who wants to create a game that switches levels back and forth.

So making a array then saving that information to a file then loading that array back and forth between levels looks like the only way to get around this issue.
chafari
Valued Member
13
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 5th Aug 2018 22:13
Well...I have never made a complet game with lot of levels..most games where made to go forthward, I suppose we will have to save an array to have the elecction which level we wana play. You could make different labels where to continue your game when load a saved data file. Some time ago I made a little program that only let you work with it ten times then it was easy to load a hidden txt that every time was dec. That is a cuestion of start with a bif game

Cheers
I'm not a grumpy grandpa
gamehazer
1
Years of Service
User Offline
Joined: 2nd May 2018
Location:
Posted: 5th Aug 2018 22:16
Yes, a Game with a lot of levels that you can go back and forth to each level.

So if you want to go back to level 1 section 1 you can, but in order to do this and do it all the time I have learned the best way is to save all the information to a file, then load it back in every time.


Its getting hectic to be honest, but worth it.
Derek Darkly
7
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 25th Aug 2018 00:11

Latecomer to the convo..

Quote: "Its getting hectic to be honest, but worth it. "


Agreed... personally, I haven't made more than $30 from my programming, but I just love to experiment and try to expand my mind.
I am terrible at math by nature, but I have discovered so many little things on my own (for example, i figured out myself, before ever reading about it, delayed user response (on the player's own screen) for multiplayer games as a way to sync everyone up better. It's those little rewards that make the violent thrashing of the keyboard nights all worth it.

I would advise anyone to pre-plan your entire project "on paper" before you start coding. I'm not always patient enough to do this myself, but literally meditating on your goals can open up insights to problems before you even get to them!
Send your parents to noisy sprite demo hell... enter the D-Zone

Login to post a reply

Server time is: 2019-08-24 08:13:40
Your offset time is: 2019-08-24 08:13:40