Tetris for beginners help!

Started by
18 comments, last by Codarki 15 years, 1 month ago
BlueBan007,

It looks to me like the blocks.bmp file is in the wrong directory. There's no error checking in the code, so it won't warn you if the file hasn't been found. I read through the thread and it seems a number of other people had similar problems.

Quote:
If you compiled it, and then executed it, and it comes up with a blank/black background, then the .bmp file isn't in your Projects folder, thus not showing the falling blocks.


I think that's probably right. When you say you've added the file to your project, has it actually copied it to the project's directory or is it just referencing the file from the project?

To the other posters: it's irrelevant how long the code is for this. It's a tutorial which is aimed at beginners. Obfuscated code which you've posted has zero readability so it's not even worth bringing it into this thread.
Advertisement
That's a... very misguided attempt to help beginners, and over five years old. :s
http://i38.photobucket.com/albums/e119/daydreamer09/devquestion.jpg

Go here, they're in the same folder I believe.
Why is "blocks" a shortcut?
I sent it to the desktop to find it easier,

does that make a difference?
Yes, that does make a difference and is what is causing the problem.

While a shortcut seems like a simple link to us, it is actually a file (a .lnk file, for a shortcut in Windows to a local file, to be specific) - When you click it, Windows knows to look inside for the location of the real file, and to run that file as if you had clicked on the real file instead of the shortcut file.

But your program isnt using the desktop to handle your files, its using its own programming to handle the files. When you tell it to load blocks.bmp it looks for that file - it isnt looking for blocks.lnk, and even if it was it wouldnt know what to do with it to find the real file.

So you need to have the actual file in the directory, not a shortcut.
Quote:Original post by Possumdude0
O.O

Shortest tetris code ever (by line count, unverified claim I'm making right now):
http://www.matthewleverton.com/misc/20lines.html


I don't really know how long a normal (as in, actually readable) tetris game's code should be, but 750 lines seems a bit long.


Doesn't count, technically, you can squez it all into 2 lines.. that doesnt make it 2 line code..

Besides.. I have a platformer demo that is shorter than 750.. X_X

kost.
Quote:Original post by kostiak2
Doesn't count, technically, you can squez it all into 2 lines.. that doesnt make


of couse u could, but what counts is to have only one statement or expression per line.

ok, now im getting linker errors...omg.

[Linker error] undefined reference to `BitMapObject::operator HDC__*()'

ld returned 1 exit status

C:\Dev-Cpp\Makefile.win [Build Error] [Project12.exe] Error 1



I think the problem might be the type of project im running...basic windows app?

or the .exe file...

but idk what to do, D:
I have to say I support the idea for creating most simple games as beginner, such as tetris.

Quote:Original post by BlueBan007
I have recently looked into the article about tetris for beginners

I didn't really study the whole code, but seems alot of beginners are having problems with this "easy" article. For what I skimmed through, it seems like a tutorial for Win32 GDI. There is an conversion of the same program to SDL at page 6, after which the complaints in the thread stopped. Maybe have a look at that?

Quote:Original post by Zahlman
That's a... very misguided attempt to help beginners, and over five years old. :s
It has been so long since I learned the basics, when you wrote stuff directly into video memory, what is the current path for graphics programming? SDL?

This topic is closed to new replies.

Advertisement