Jump to content
  • Advertisement
Sign in to follow this  
RSL

Tetris Game

This topic is 4417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I want to make a Tetris game, but I don't know how to get started. I know C++, but I'm still a beginner. Does anyone know any videos to get started?

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately I don't think there are any videos :-P

My way is to start out like this

Pick out an API- I used SDL
Make a class for a square, square should be able to show itself based on a global SDL_Surface(thats how I did it.)
Make a Block class! Block class should contain 4 squares. The BlockClass should be able to move itself while checking for collisions with the map and it should be able to show itself by calling the Show() function that each square has. It should also rotate itself.
Last Create a Map Class. The map is just an array containing integer values. 0 for black, 1 If theres a red tile there, 2 if theres a green, and so on. Map class should be able to render itself by looping through itself and display a square based on whats at that position. Map class should accept a Block class so that it can be made part of the map. Map class should also have an IsEmpty() function to see if a certain coordinate is empty. You use the IsEmpty() to do collision detection when you move/rotate the blocks!

Thats how I made my tetris game, it took me only 2 days!

http://triplebuffer.devmaster.net/articles/tetris_in_an_hour/
There is also this using Windows GDI a bit iffy to explain, imo I wouldn't use a tutorial you won't understand it as much as if you coded everything yourself.

[Edited by - Cubed3 on April 19, 2006 1:15:54 PM]

Share this post


Link to post
Share on other sites
But I haven't done much windows GUI programming. In fact, I can't even set up a proper window yet - only do messages. Where should I learn SDL? Is it easier to learn than DirectX? How many lines of code does it take? How about hours?

I'm planning to make a Tetris game after my other project, WoL. Check the URL below for more information.

http://www.rslgames.bravehost.com/projects/world_of_legends/index.html

You have to copy and paste the link for it to work though. The text RPG is HUGE.

Share this post


Link to post
Share on other sites
Hey, you can download my version of tetris, LIA2005 (on my webpage), the first complete game I ever made (it has everything a game should have). It's published under GPL so it's free and also have the code sources!

Even if it has 2005 in the name, it is actualy a bit older (like a few years ago), so the tech is not too advanced... but it may help you to get used with the DirectX stuff, which in my opinion, is the future of game programming (at least on the PCs).

DirectX it's not so hard and there are a lot of docs to help you with. If you realy wanna make some games, then you should learn DirectX [smile].

Share this post


Link to post
Share on other sites
Quote:
Original post by RSL
But I haven't done much windows GUI programming. In fact, I can't even set up a proper window yet - only do messages. Where should I learn SDL? Is it easier to learn than DirectX? How many lines of code does it take? How about hours?


It is much easier than DirectX. Lazy_foo has some nice tutorials at his site on SDL.

http://lazyfooproductions.com/SDL_tutorials/index.php

However, after you learn SDL you should definately check out OpenGL or DirectX, they're much more advanced, yet the learning curve is steeper.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!