Log In  


Working on a game with a scrolling overworld, with collisions. Not sure yet what it will become, so basics for now.

v0.20 (2016/12/13):

Cart #33444 | 2016-12-13 | Code ▽ | Embed ▽ | No License




That framework is a good place to start. I used it for my own game too.

But just as a quick list of functions to lookup and learn about that will help...

camera()
mget()
fget()
map()


Thanks - I'm looking for more of a scrolling overworld than a platform game, but there's useful stuff there anyway.


OK so that was easy so far.

Cart #32457 | 2016-11-14 | Code ▽ | Embed ▽ | No License


(Moved thread to WIP as it's better suited there now!)


You should draw the map like it is described in this thread:
https://www.lexaloffle.com/bbs/?tid=2348


Not quite sure what you mean? So it only draws the visible area, rather than everything? If so, I intend to do that later.

Current progress is slightly wonky collision detection (walls are "solid"):

Cart #32491 | 2016-11-15 | Code ▽ | Embed ▽ | No License


Yes. I assumed you were already working on that, but I still pointed it out because it will probably be helpful to other newcomers, too.


OK, I've made the map draw just the "local area" (which has the side effect of letting me change the viewport, so it doesn't have to be full screen!) with:

map(loc.x/8,loc.y/8,loc.x,loc.y,16,16)

but now scrolling is horribly jerky.

Cart #32494 | 2016-11-15 | Code ▽ | Embed ▽ | No License


The draw coordinates (sx, sy) are off. Probably want to flr() the map coordiantes (celx, cely) ,too. Additionally draw 17 rows and columns, because some tiles might be partially off screen.

map(flr(loc.x/8),flr(loc.y/8),flr(loc.x/8)*8,flr(loc.y/8)*8,17,17)

I had them flr()'d but took it out to see if it'd help. It didn't. I'll try your suggestion though.


Aha! It worked! Well, the sx,sy anyway - flr() on the celx,cely doesn't seem to make a difference.

Now to work on the collision detection. Is there a way to define a "hitbox" for my character sprite? At the moment I can clip through stuff if I don't line up!


map() probably ignores the non integer part on that.

For actor/actor collision detection with hitboxes I really liked this tutorial:

https://www.lexaloffle.com/bbs/?tid=3948

In that example only collision detection is shown, but collision handling should not be too hard.

For actor/wall collision you should check out zep's example. He uses fixed size characters in that example, but it should be easyly adabtable to differently sized hitboxes.

https://www.lexaloffle.com/bbs/?tid=2119


Thanks! Currently looking at displaying messages in a message window at the bottom of the screen (I detoured a bit...), but will get back to collision detection after that.

Cart #32500 | 2016-11-15 | Code ▽ | Embed ▽ | No License


Haha! Collision detection is not going well. Still trying though :)


Fresh eyes this morning, and I've managed this.

Cart #32547 | 2016-11-16 | Code ▽ | Embed ▽ | No License

Still some issues - I don't like the "kludge" where I have to offset the sprite. Have I missed something? I want it to line up exactly without moving the sprite over to account for being a square out!

Still, closer than it was before. Also, status area at the bottom in place now. If you walk over the yellow cross panels it triggers.


And collisions are fixed! Well, wall collisions, anyway. I need to provide similar logic for the "warp" panels though.

Things feel like they're progressing! Next task is to have things to interact with.

by
Cart #32606 | 2016-11-18 | Code ▽ | Embed ▽ | No License


Well that took a while, but I have warp detection working correctly now, with the bits in place to allow warping from one to another!

Cart #32732 | 2016-11-24 | Code ▽ | Embed ▽ | No License


Well, it's been a little while but I've done a lot of rewriting. I wanted to add doors and switches, with the ultimate aim being to have the switches trigger the doors to open and close, and realised I was duplicating a lot of code: creating three types of object, checking for collisions on three types of objects, drawing three types of object...

So I combined them all!

Cart #33205 | 2016-12-08 | Code ▽ | Embed ▽ | No License


I have working warps! Wooooooo!

Cart #33444 | 2016-12-13 | Code ▽ | Embed ▽ | No License



[Please log in to post a comment]