LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Do i have to have a loop for my whole game?

Root / Programming Questions / [.]

cruzisonfireCreated:
If my game requires a guy moving and stuff with moving enemies, do i have to have a loop for the movement with the map info in the loop as well or could i just load the map info then start the loop for sprite movement??? Sorry if this is a dumb question im kinda new to smilebasic and want to learn more.

Usually a game has a "main loop" for everything that needs to run during the game. Loading the map itself is usually outside this loop; that's why you see loading screens before beginning a level in real games. The main loop then handles moving the view around the loaded map, moving the characters and enemies around, and handling all the damage and whatever. HOWEVER, if you go into a new area that requires a new map load, you usually briefly exit this loop in order to load the new area, then reset all the enemies before jumping back into the main loop. This can be done with things like GOSUB or functions.

If you understand how games are being displayed, you will notice that is indeed a "Main Loop" that is running. Look at it at this non-precise example: 1.- System gets the updated data 2.- System "shows" the data in form of visible graphics And so on...