Rpg style movement

Blitz3D Forums/Blitz3D Programming/Rpg style movement

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You shouldn't have multiple updateworlds in your main loop, because it would slow down everything. You'd best do something like this :
UpdatePlayers_Before() ; player movement etc
UpdateEnemies_Before() ; enemy movement etc

UpdateWorld()

UpdatePlayers_After() ; linepicks, position shadow at linepick coordinates, etc
UpdateEnemies_After() ; linepicks, position shadow at linepick coordinates, etc

Renderworld()
You can store the results of the linepick in the player's type if you need to use it in UpdatePlayers function.

In the UpdatePlayers_After() function, you can also compare the LinePick with the player's height to know if he's floating somewhere or not - I use this for jumping and gravity... When the player jumps, set player\jumping to true, and use this to make sure he can't keep jumping even when in mid-air like you can do in the castle demo. When the height of the player minus the linepickheight is very small, set it to false.
In your UpdatePlayers_Before(), you can check player/jumping - if it is true, increase player\dy# which is the amount you make him move down each frame. If it is false, set player\dy to a very small value (or 0, but I found a small value worked better).
This is all a bit off topic, but I think you might find it usefull :)

But if you do need multiple updateworlds, put it either after the last one, or after the one that comes after your player movement routines (where you apply gravity).