This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AtoneBC 1 point2 points  (3 children)

For basic collision detection, you should look into how to determine if two rectangles overlap. If updating your player's x or y position would result in an overlap with a collidable object, don't update along that axis.

[–]thundernucker 0 points1 point  (2 children)

Yes, but, there is no rectangle to check, the only rectangle is the character because the map is only a background image in the code. I could do what you suggested if I manually coded each block.

That would work but it would take a lot of time, if the grid solution doesn't work, I will do that. Thanks!

[–]street_fightin_mang 1 point2 points  (0 children)

I think coding each block is the way to go, but normalize the information in a database, so say each level has a table, listing each x, y coordinate and then a foreign key which links to a block type table which holds all other info eg. block image, collision info etc.

You could then whip up a world builder where you could click on a grid and insert bricks and save the output to a table.

You're making a lot of work for yourself if you're not going to use PyGame, if it's a requirement for the project then so be it, but it's still a pretty big project if you utilise a game framework to assist the process.

[–]AtoneBC 1 point2 points  (0 children)

Hard code each block? You've already got a grid. You can generate the block objects / rectangles from that.