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.

Newcomers DBPro Corner / randome objects

Author
Message
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 4th Nov 2003 02:19
i want to make a tetris game and i dont kno how to make randome objects. Theres already a randome object post but i dont want only one object ya kno how tetris has like 4 or 5 different types of bricks i want to be able to randomize them.thanx

tim
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th Nov 2003 03:16
you might want to make the blocks externally then load them in as object 1-5 then call a rnd() function to return 1-5 (0-4 +1)then grab the right object based on the rnd number

-RUST-
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Nov 2003 15:53
the way I drew the shapes in my tetris game was to use 4 squares and offset values to position them. So if your shape position is at x,y (top left of shape), position the 4 blocks according to that. So to make a square shape you could position the 4 squares like:

a=x,y
b=x+1,y
c=x,y+1
d=x+1,y+1


Make any sense?

I could post my tetris code if you need further help. It'll have to wait until I get outa school, which is gonna be awhile. I have a 10 hour school day on tuesdays, ugh!
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 4th Nov 2003 21:31
yea could you that would help a lot.

tim
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Nov 2003 22:33
Well, I'm still in school, another 2 hours to go. But I remembered that I posted my tetris game on here awhile ago. http://darkbasicpro.thegamecreators.com/?m=forum_view&t=17294&b=6

Instead of sprites, I used planes. A habit from using DBC.(slow 2D)
Sorry its not heavily documented.
Black Hydra
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 5th Nov 2003 02:09
To use random() you must have an integer parameter or argument.

random() cannot call functions like Make Object but there is a way around that.

For example

RandomCube = random(5)+1

if RandomCube = 1 then Make Object Cube 1, 10

if RandomCube = 2 then Make Object Plane 2, 10...

like so.
I think Tetris might be a bit to hard for a begginer. Try pong or space invaders they are easier. Space Invaders was a good stepping stone for me
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 7th Nov 2003 01:07
yea i think im gunna try somthing easier cuz ur tetris game was like huge and i didnt understand anything. I just picked tetris because i thaught it would be easy.

tim

Login to post a reply

Server time is: 2024-11-25 16:28:05
Your offset time is: 2024-11-25 16:28:05