WIP 2d adventure game

(gif is slow. my game runs smooth)
resources used on image from opengameart, just to check if everything works. I will replace them. List here:
bat: Charles Sanchez
campfire: Jetrel and Zabin
player: edzet from deviantart (I think)
grass, water, tree: Lanea Zimmerman

I’m trying to create a 2d adventure game. This is not a rpg. I will not implement fight system. Instead, I will create puzzles and side-quests.
This is some kind of “tool / engine / template”. Still need many work.

Done:
-game states
-game loop
-load sprites
-load tilesets
-load maps
-layers
-animated tiles
-animated sprites
-movement
-collision
-keyboard input
-scroll map

Work on:
-automatic move sprites to xy

To Do:
-dynamic collision (all objects that can move like sprites)
-automatic move sprites to xy
-menu
-inventory (maybe)
-map editor
-events
-gui
-change resolution and handle full screen
-~
-clean and optimize code

Looks good so far.
What kind of puzzle will it be?

I exactly don’t know the main theme yet.
I want something fun for all ages but with good puzzles to solve and some “boss” puzzles.
Puzzles must be related with the game theme.
I have something that I want to do, but I don’t know yet if I will do it at this point.
So I can’t tell how my puzzles will be.

Would it be a zelda kind of theme or maybe a magical concoction of coder puns :slight_smile:

Do you have any idea about the plot? And about the puzzles, you could include some enemies (although there’s not a fight system) as part of them.

I will focus first on finishing this “template” of code.
When everything works (gui, scroll maps, load / save system, path finding for AI, …) I will work on a decent background history, but I have 2 plots that I want to see in a game.
This is not an engine though, I just want to make a template so I can re-use to create something new.

Plots i’m thinking:
-Fantasy: Unexpected history line with some clever jokes in the background. The player find an old fantasy book. The game consists of the stories written in the book.
-Comic: A shepherd falls asleep and one of his sheep get away. He need to find that sheep. This one seems kinda bad, I still need to work on.

I’m not thinking on a serious and mature story line now. Just need to code everything.
Also, I need something simple to re-write for android. I will have my first game released on play store this month I hope.

Looks sweet man, if you can post a playable demo on here. ;D
Will it be open source or closed source?
Your welcome to take code from TheEntropyGameEngine, to
help build your collision system. But it might not be right for your game.
https://github.com/Saucymeatman/EntropyGameEngine
If you take from it, give me a star or +1 :wink:

Anyway, happy coding

I guess I can post the code with some kind of tutorial when I finish.
Thank you, but I like to program and know all my code. Also, I don’t know if my game works well with your engine (without to many changes).

I will be happy to release a demo, but this will take at least 1 month to be stable. I’m rewriting some code.

I need some tips here.
With is better, move sprites on a grid or free?

pros (in my opinion):
-player will never be “stuck” if he want to enter some house, because game will center player with door and don’t touch walls.
-easy to implement npc movement. Something like: moveTo[4,10];.
-nostalgic gameplay. If i’m not wrong, old 2d rpg games use grid system, like Final Fantasy.
-easy to implement and also easy to interact map with objects and collisions.

cons (in my opinion):
-maybe will not suite for all player be stuck on a grid and can’t move freely.
-collisions must be made with grid too and if I have something small inside a tile that I need to block, player will have awkward free space that can’t walk.
-map limitations. I need to draw almost everything on a grid to avoid awkward collision borders.
-player need to wait for movement to complete (reach next tile) before change direction (for example go up and go left).

I don’t know. With my code now, player can move freely but I want to move sprites to x_tile and y_tile because is easy to manage game events. (example: if playerPos==[10,10] moveBat[9,10])

Move them freely. I like being able to explore my environment, and being restricted to a grid doesn’t promote exploration!

Thank you. Tomorrow I will check it out.
But you are right.
I’m still thinking in a way to implement grid position and normal x and y.
Useful to move sprites to x_tile, y_tile, check events etc.

Maybe I will just do something like this: tile_x = x / frame_size_x.
The problem is if I’m 1px left this will trigger my left_tile and I’m on the right_tile.
Maybe if I use double variable I could check what size player is more closed to:
2,4 = tile_x = 2
2,6 = tile_x = 3

I need to check this tomorrow, if someone have suggestions are welcome :smiley:

Use something called AABBs. It stands for Axis Aligned Bounding Boxes, and it basically is a box that surrounds the entity and can collide with other boxes as long as they are aligned to an axis (meaning it hasn’t been rotated).

Take a look at this tutorial from our own forum!:
http://www.java-gaming.org/index.php?topic=27326.0

But I already have my collision done.
I want to move enemies and npc without calculate real coordinates, but instead use tiles. Move to x,y tile.
And check what tile my player is too.

I guess I could check collision for every tile to see if I’m in, but this is not the best way to do it.
I’m over thinking this one. And it is simple.

Tomorrow I will check this out with a fresh brain. ;D

Nah, you need to check the collision for the entity, or else you really can’t have movement off the grid. If you are doing it tile by tile, that would work, but since entities can be on two or more tiles at the same time, you need a way to check the actual entity’s coordinates and base collision off of that.

Trust me.

Ok, I changed my Collision method.
I check real collision coordinates and also I check sprite layer. If layer > collision just overlay and don’t stop (for flying sprites, etc).

Also, I will implement setTo(x_tile, y_tile).
It is easy… I just need to multiply x_tile * frameSize[0] and y_tile * frameSize[1].

Yesterday I was over thinking.

More updates soon, and maybe a demo just with movement and collision detection.

Update:
Scroll map done. Everything works smooth and only tiles on screen are drawn.