Making another level issue

BlitzPlus Forums/BlitzPlus Beginners Area/Making another level issue

Jax9123(Posted 2013) [#1]
Well, im having the problem where i make another level and i want to change the player coords. But for some reason, i dont know how in the while loop.. i hope thats understandable for you and i hope its not a dumb question


Midimaster(Posted 2013) [#2]
that's a bit too little code to see your problem...


indietom(Posted 2013) [#3]
if winLevel then player = level2


Kryzon(Posted 2013) [#4]
What you need to do in cases like this is to turn off the computer, go to a quiet desk and starting sketching (on paper) a logic diagram: what you want the program to do.

What does it take for the player to "win" the level? what function checks for this condition? this is the function that will call another function to load the new level and change the player position.

You probably have variables and Type instances that store all your level data: tiles, background image, etc.
You need to program a function that frees this currently loaded content and loads in the new content for this new level you are entering; it should also position the player at his new spawn point, etc.


FBEpyon(Posted 2013) [#5]
Hello Jax9123,

What I have done in the past for dealing with levels is make sure the Player has Current Location, Previous Location, Next Location information stored in the Player Type.



The Previous location is important if the player dies and you want him to load at the Previous Loaded location.

The Next Location is used for map loads, so when you load your new map it provides the location in which the player will be placed on it. Once the map is loaded you take the Next location information and place it into the Previous (for dealing with death loads) and Current Locations.

This is how I do it, I'm sure there are easier ways of doing it though.

The TVec2D is another type that I use to store the x,y and possible z but that would be a Vec3D type.



Also the code above is BlitzMax code I haven't used Blitzbasic syntax is a long time. also is very pseudo code, so it won't work if you just copy it.