I'm glad that this helped or served someone. The "engine" was a bit preliminary but since the beginning tried to make the map, the mobs and so on the most easily configurable/changeable. Good luck with the project, and keep us informed.smiller wrote:Thank you very much! This was useful! I am adding onto this to create my game. I loved how I was just able to change the tile size and everything still worked. I think someone once described this to me as having "no magic numbers". Very easily changeable.
I won't rely on it too heftily... soon it will be something of it's own.
[RIP] LÖVElike - A Roguelike Engine ("Bärrelike" flavour)
- arquivista
- No longer with us
- Posts: 266
- Joined: Tue Jul 06, 2010 8:39 am
- Location: Insert Geolocation tag here
- Contact:
Re: LÖVElike - A Roguelike Engine (aka "Barrelike") -Abandon
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
Re: LÖVElike - A Roguelike Engine (aka "Barrelike") -Abandon
I noticed how it was working, but you put a note that the psuedo-camera window offsets (x and y) needed to be fixed. What's up with it that needs to be fixed? I can fix it myself, I am just more curious than anything.arquivista wrote:I'm glad that this helped or served someone. The "engine" was a bit preliminary but since the beginning tried to make the map, the mobs and so on the most easily configurable/changeable. Good luck with the project, and keep us informed.smiller wrote:Thank you very much! This was useful! I am adding onto this to create my game. I loved how I was just able to change the tile size and everything still worked. I think someone once described this to me as having "no magic numbers". Very easily changeable.
I won't rely on it too heftily... soon it will be something of it's own.
- arquivista
- No longer with us
- Posts: 266
- Joined: Tue Jul 06, 2010 8:39 am
- Location: Insert Geolocation tag here
- Contact:
Re: LÖVElike - A Roguelike Engine (aka "Barrelike") -Abandon
Thanks for talking about that smiller. I should have fixed that long ago. Offset is working now. Uploaded 0.54. Code and method is not what I wanted (I desire to put it even more simple) but at least offset is functioning now. Also increased a bit the map just to test auto-size window/info border and auto-center text.smiller wrote:I noticed how it was working, but you put a note that the psuedo-camera window offsets (x and y) needed to be fixed. What's up with it that needs to be fixed? I can fix it myself, I am just more curious than anything.
The problem why wasn't really working is that since I simplified a bit the engine used in tutorial. So the LÖVElike engine wasn't working with the tutorial offset formula and I had to alter things but never succeed in putting things as I really wanted. Offset was badly implemented and was "dummy" code. It works properly now but I still would prefer to even simplify how things are done a little more.
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
Re: [RIP] LÖVElike - A Roguelike Engine ("Bärrelike" flavour
Also, just wondering, where in the heck in the code does it say where the map begins being drawn in the window? I can not for the life of me find where the map is being moved for the border to appear.
- arquivista
- No longer with us
- Posts: 266
- Joined: Tue Jul 06, 2010 8:39 am
- Location: Insert Geolocation tag here
- Contact:
Re: [RIP] LÖVElike - A Roguelike Engine ("Bärrelike" flavour
The fast explanation:smiller wrote:Also, just wondering, where in the heck in the code does it say where the map begins being drawn in the window? I can not for the life of me find where the map is being moved for the border to appear.
"map.camera_offset_x" and "map.camera_offset_y". At the moment they have both value 32 thats puts the "camera map" 32 pixels away (in x and y axis) of the top left corner. Obvious if you put 0 in both you will put the "camera" at top left corner (x0,y0).
The detailled explanation:
You know this part for sure, but let's recap. The map is drawn in function draw_map(). In the "For" loop first draws every piece of map tiles according the pretended "map camera" size (camera_height, camera_width), then the hero and the mobs over the map. This is a realtime routine called endless when you are playing.
Since last version map area really starts draws (as it should) in default at x0,y0. However in function setupMap() you have 2 variables that pushes far you wants the coordinates where map loop starts drawing. That are the Offset variables "map.camera_offset_x" and "map.camera_offset_y" where as you see are both with valor 32 just for this engine demo create the border/margin area effect. Those values puts the beggining of map at x32,y32 (pixels). So as you can see the map don't starts at 0,0 but have a "border" of 32px giving space for the text values be drawn outside the map. (BTW: 32 was also chosen because is also the value of tile width and height). If you want to draw map instead at 0,0, (reset) or any other place in the window just need to alter that two offset values to the values in px you want. So with values "0" don't alter nothing. "Play" with those variables and you will see the difference.
Let's check the instruction that draws ONE piece of tile map inside the "for" loop (that draws all "map camera"):
Code: Select all
love.graphics.draw(
tile.layer_low[map.data[y+map.y][x+map.x]],
(x*tile.w) - tile.w + map.camera_offset_x,
(y*tile.h) - tile.h + map.camera_offset_y)
So map_offset_x/y are the magic numbers, put at 0,0 if you want that map starts at beggining of top-left corner of window, left it at 32,32 as I'm doing to create the border area or pushes farther in the window by putting a greater valour. It's your choice where the "map camera" starts to be drawn.
Note: In older version spite of value the offset variables weren't working well so the map was being draw starting at x32,y32 (spite offset value was 0) so that's why "offset" was broken. Now it does it at by default at 0,0 (as it should be).
I know that I explained more than you needed but that way I hope don't left on you any doubt.
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
- arquivista
- No longer with us
- Posts: 266
- Joined: Tue Jul 06, 2010 8:39 am
- Location: Insert Geolocation tag here
- Contact:
Re: [RIP] LÖVElike - A Roguelike Engine ("Bärrelike" flavour
Small update uploaded:
0.055 - Null, Paused, Help and Quit states/modes added. Extended Movement added. Flag to switch Extended Movement on/off. Additional keys set added.
0.055 - Null, Paused, Help and Quit states/modes added. Extended Movement added. Flag to switch Extended Movement on/off. Additional keys set added.
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
Re: [RIP] LÖVElike - A Roguelike Engine ("Bärrelike" flavour
BE REBORN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Who is online
Users browsing this forum: No registered users and 5 guests