123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|426|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Tetris

Fri, 28 Dec 2007, 11:41
garand
Hey, I'm going to post all of the questions/problems that I am having with my Tetris clone, here.

Here's the first one.

A problem with arrays.



Thats what I've got so far. Displaying the blocks is just a test but it should work. If I replace



with



It displays the right values but with the draw image code it says that the image doesn't exist.

Thanks
Fri, 28 Dec 2007, 12:05
magicman
im just going to take a stab at this after looking at it for a couple secs but i think it might have something to do with the "imageblocks$(block_number)" being a string. i dont know if you can do that or not, but if i had to guess i would say thats the problem.


|edit|
ok, yeah, try making it not a string and changing



to



see if that helps

-=-=-
Stuff... Yeah...
Fri, 28 Dec 2007, 12:32
garand
Yea, that worked, thanks.
Sat, 29 Dec 2007, 03:26
garand
Array index out of bounds when trying to display the image.


Sat, 29 Dec 2007, 03:38
garand
Now no error but also no image.


Sat, 29 Dec 2007, 03:46
garand
Got it. Wonderful.
Sat, 29 Dec 2007, 11:53
Hotshot
I think making teris game isnt easy unless you know how to do it.
Sat, 29 Dec 2007, 14:02
Scherererer
I think making teris game isnt easy unless you know how to do it.


That statement can be applied to pretty much anything.

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Sat, 29 Dec 2007, 14:48
Forklift_Fred
Very true. It's more complicated than you might first think but it's as good a place to start as any, just to see how things go together. Anyone starting out shouldn't expect their first project to amount to a great deal. If you are simply running through tutorials or trying out exercises then the results will be pleasing because they work but they won't be much to look at on the whole.

-=-=-
Come rain or shine...
Sun, 30 Dec 2007, 16:50
garand
Hey, Ive got the type stuff done but it doesnt display anything. I dont know why? Any help, code, and or guidance would be greatly appreciated.


Tue, 01 Jan 2008, 13:27
Forklift_Fred
OK... I took a look and there are several issues to address. First of all, you should only use Cls and Flip once every cycle so I would suggest removing all the ones within functions and put Cls at the start of your "While Not KeyHit(1)" loop and Flip at the the end of it (where it is at the moment)

This won't solve your problem of nothing being drawn though...

The problem is that no blocks are being created. If you run the code in debug mode and step through it, you'll see it checks If fallingblock.block <> Null and then skips over it. This is because fallingblock.block is ALWAYS null before any blocks have been created if you change it to If fallingblock.block = Null then it will work... but only once each cycle. I'm not sure what you are trying to do here but I suggest you remove the If...Then statement completely. That way it creates 10 new blocks every time... It does 10 every cycle though which I suspect isn't what you are after...

As I say, there are several issues with your code, some of which I suspect are because it is still in development and you are still working things out so that's fine. However, I don't know about anyone else but I was disorientated by your layout order. Personally, I start with the variables etc (which you have to), then the program loop, then functions and finally any data statements. I'm sure everyone has their own preferences and I don't think it has caused any problems but it confused me to start with because I thought you just had your functions but weren't calling them I don't normally criticise other peoples coding style so I apologise but it threw me off right at the start.

I'm not sure I understand your CreateBlock() and Do() functions but have a look at what is happening when you change the If fallingblock.block <> Null part and we can take it from there.

Oh, what are the images like? Just a minor detail but I made them as simple coloured squares to see what was happening because I got the impression that was basically the idea of them?? (also, it may help later on to know what size they are)

I hope this is all as helpful as I'm trying to be...!

-=-=-
Come rain or shine...