Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Tetris?

Author
Message
Lascerus
22
Years of Service
User Offline
Joined: 14th Feb 2004
Location: spaced out
Posted: 16th Aug 2004 04:35 Edited at: 16th Aug 2004 04:43
I'm a newbie in programming but not such a newbie in graphics. I intend to use darkbasic pro. I need help on the basic game engine i.e. where to start and the physics engine ... after a collision I think I can handle it...any help please?

Umm..I just remembered the search function works differently from thread 2 thread...sorry, i found some code using it, I'm going to ply around with it now....
Lascerus
22
Years of Service
User Offline
Joined: 14th Feb 2004
Location: spaced out
Posted: 22nd Aug 2004 04:16
Ok i tried some stuff and this is what i got from what i found and i created my own graphics....so how do i set up the physics and game engine...the blocks need to fall to a point and join with other blocks....it also has to have that brock breaking(like when you score) thing which i cannot even begin to program...would i need to create the sprites using code or can they be split....I'm learning any help please?

I also inculded the code i'm using....
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 22nd Aug 2004 06:51
The easiest way is to have an array that represnts the game area. each element of the array will be a square. Then have values for the array elements that represent the different states a square can be.
Typically
0 = blank square
1 = moving square
2 = stationary square

Then just have a function that draws a representation of the array to the screen, Just paste a copy of the square image where there is a 1 or 2.

A function that moves all 1s down until the shape hits the bottom or a stationary square(2).

A function that checks for completed lines and removes them as well as moving all squares above the completed line down.

A function that checks to see if there are no moving squares(1) and if there are none spawns a new piece at the top.

shrink those dbpro exes
Create patches for your dbpro games
Lascerus
22
Years of Service
User Offline
Joined: 14th Feb 2004
Location: spaced out
Posted: 22nd Aug 2004 16:00
do you mind if i use some of the source from your website but use my own graphics then we share the credit, I'm not really a programmer but i do want to learn. Thanks for the help,
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 23rd Aug 2004 02:22
You can use the code on my site if you want. I wrote it quite a while ago and can't remember what state it is in. It might not be very readable or understandable.

Click the source button for some minimal tetris code. It only has one shape (square) and only has code to move the square and move it down the screen. It should show enough to get you started

shrink those dbpro exes
Create patches for your dbpro games

Login to post a reply

Server time is: 2026-06-11 13:13:31
Your offset time is: 2026-06-11 13:13:31