I am wanting to learn how to make a 2d sandbox game in python but i'm not sure where to start. (Like making the blocks destroy able, etc) I have made a few simple games like pong and stuff just to get the hang of the language. If anyone could point me to a good tutorial or if you could teach me yourself that would be great. :) Any help is appreciated.
I'm not sure if you're going to find a tutorial on how to do a sandbox game, because for one thing it's a very loose description and for another a decent sandbox game requires quite some time and effort.
Making blocks destroyable... well, you're gonna have some kind of list of block objects. If you want to destroy one, you just take it out of the list, so that when the game updates again, it's just not going to see the destroyed block anymore.
You might be able to find a tutorial on how to write a breakout-clone. It's not a sandbox game, but it should have destroyable blocks ;)
also there is no standard way to make a sandbox game, nor is there a specific tutorial to create x and y game
[URL="http://contraptionmaker.com/"]this is way ahead of you[/URL]
I wanted to make something like terraria but I don't want to be called a copycat lol. It wont be entirely like it cause I have some pretty good ideas that aren't in that game
[QUOTE=Avterra1d;42875516]I wanted to make something like terraria but I don't want to be called a copycat lol. It wont be entirely like it cause I have some pretty good ideas that aren't in that game[/QUOTE]
the most you did was pong
you'll need a hell of a lot of learning before you can make anything close to terrarria
So, you're building a python game. What are you using. If I were to guess, I'd guess you're using pygame.
You want to make a sandbox game. Well that can mean just about anything. I'm going to assume that you'll want to sort of physics. With these assumptions I'd recommend pybox2d ([url]https://pypi.python.org/pypi/Box2D[/url]).
You say you want to make blocks destructible. This is highly non specific. I'm going to assume that you're using pybox2d.
Breaking blocks can mean just about anything. I'm assuming your blocks can sustain some damage or have some health. In this case you'll probably want to have a class that represents an object in the world and that class should have a health field and probably a damage method or something of the like. Further more you'll probably want some kind of an abstraction layer. So you'll need an "Damagable" abstract class or interface.
Now, when a block breaks, you'll probably want to delete it from the world it's a part of. How do you do that? I don't know, you haven't told me what a world in your game is. If you're using pybox2d, then there's a way to do that (look it up in the doc).
Well that's all cool but your blocks won't magically know when to break. If you game has guns or something, then you could check if a bullet collided with a block and decrease its life. If you're using box2d, then there's a cool bullet object (I think).
Maybe there are no guns. Maybe blocks break when you toss them on the wall. In that case you'll need to check for collision and figure out the force of the block hitting whatever it hit and damage it accordingly.
Then again, I could be completely wrong. Maybe you're rebuilding minecraft or terraria. If that's the case everything I just said was a waste.
If you want help here's some of the information you need to give us:
- What do you know?
- What do you want to make? (describe in details what kind of a game you want to make)
- What libraries are you using?
- Define sandbox
- Define block
- How does one break a block?
Sorry, you need to Log In to post a reply to this thread.