Hi, I'm relatively new to this, and have put together a maze generator (using the Randomized Prim's algorithm) with a player to navigate around the maze.
The maze generates fine, and I have created physics boxes for the walls and the player with no problem. I can get the player to move around the map, but the map, whilst scrolling at the same rate, is not moving the drawing range quickly enough. I.E. it is starting drawing an earlier tile than it should.
I realise that this is not that easy to explain in words, however if you run the file and move right/down (using wasd) you'll see the map stop drawing.
Have I missed out a +/- somewhere, or am I misunderstanding something about graphics.translate (or something else entirely!)?
Many thanks,
BCvery1
Tile map scrolling
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Tile map scrolling
- Attachments
-
- MazePrim.love
- (55.04 KiB) Downloaded 137 times
Re: Tile map scrolling
About physics bodies:bcvery1 wrote:Hi, I'm relatively new to this, and have put together a maze generator (using the Randomized Prim's algorithm) with a player to navigate around the maze.
The maze generates fine, and I have created physics boxes for the walls and the player with no problem. I can get the player to move around the map, but the map, whilst scrolling at the same rate, is not moving the drawing range quickly enough. I.E. it is starting drawing an earlier tile than it should.
I realise that this is not that easy to explain in words, however if you run the file and move right/down (using wasd) you'll see the map stop drawing.
Have I missed out a +/- somewhere, or am I misunderstanding something about graphics.translate (or something else entirely!)?
Many thanks,
BCvery1
From love.physics on the wiki:
"love.physics is not lightweight, and not even remotely simple to use. It's a ten-ton hammer designed for heavy-lifting (er...hammer...lifting?)
If you are just trying to make a character jump around on blocks or the likes, then move along, nothing to see here."
By using love.physics you are overpowering and slowing down your game plenty. Box2D/l.p is made well enough for you to not notice that immediately, but as you build larger levels and have enemies and other dynamic objects this might get hard to keep up, it also is more complicated than a more fitting solution like bump.lua anyway.
I will look at your actual code & question when I'm home.
Re: Tile map scrolling
I have added a physics world debug function to your main.lua file. Here is the updated .love archive. Play around with it and see how you can make map scrolling.
The only thing I added was the debugWorldDraw function and its callback, plus I disabled your own world draw and called the debugWorldDraw function in love.draw, all in main.lua. The important part for you is the translate coordinates.
The only thing I added was the debugWorldDraw function and its callback, plus I disabled your own world draw and called the debugWorldDraw function in love.draw, all in main.lua. The important part for you is the translate coordinates.
- Attachments
-
- MazePrim_debug.love
- (55.87 KiB) Downloaded 121 times
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests