New account registration is temporarily disabled.

SDL WITH C

Posts

Pages: 1
Hey all,

I mentioned in a thread a while back that I wanted some advice on a small game (RPG), and in that thread I mentioned that I want to make games leveraging SDL. Then I fell off the face of the earth from class; however, I lucked out and found a small point where I could learn SDL for a small game in the class, so I posted it here:

https://github.com/jsburke/Tetris

I plan on putting a prerelease of this up maybe tonight or over the weekend. I'll do one targetting windows (which is in this build) and one for Linux (I think it should work for Mac too, I hope). This way you can get to an executable easily.

Overall, it was a fun project to pull out for a first one. I wrote the code in a real rush, so some of it is a mess (keypress portions, how I mangled managing images, etc). That said, I plan on tidying up some portions of it.

The way I've used SDL is crude, but it gets some of the gist of how to use it by, like pushing to screens and the like.

Not shown graphically yet, in case you do play it, is the "hold" feature. I got really dang frustrated at the RNG not giving me my long blocks when I wanted them, so I kludged together a quick portion to save blocks for later use. If you want to save a falling block, hit the space bar. Hit the space bar to pull it out again. This is because I was really lazy with RNG. Also, around 8k points it starts to get much faster. I've managed to hit 10k, but then I have no time to react, so if anyone can top that, do it.

I think my next goals for using SDL are to tidy this up (I'm going to be porting parts of it to ATS to leverage outrageously strong type-checking and so the prof can use it in an AI class), making a concise and effecient method of storing and using images for easier use in more complex games like RPGs, learning how to animate things (should be pretty easy I think), and introducing music and sound. My hope is that by the end of July to have a nice tool set up that I can build games on top of. By the end of the summer I think it is feasible to have a simple Pokemon clone. Maybe I can have a small tool for other programming oriented folks to work with to do games like this too.

But I wanted to share what I had for now and pull my head out of the darkness for a few minutes before I return to it. Feel free to critique how bad some of the code is because I wrote this with a real tight schedule or ask questions on how to do whatever.

Final note for myself since this is just hitting me and I know I'll forget, so ignore this. John, the giant ugly switch in rotation related things can be really simplified with an array of function pointers. Do this, too.

: final final note: I don't plan on submitting a tetris clone to rmn as a game. Maybe the next iteration will be more worthwhile. you all can get tetris clones anywhere, so no need for me to clog up resources here with it. I'll do that on github and my computer.
Pages: 1