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 / clone object for block building

Author
Message
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 15th Sep 2010 15:39
hey

im trying to create a 3d game like tetris but you build the blocks up. i have made 7 different blocks that are in .x format. i want to be able to move the blocks around and then clone that object when i hit enter. for some reason it isnt working. this is some simple code im using to try and get the mechanic working

boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 15th Sep 2010 16:28
i was able to clone the object by deleting it before i cloned it. i tried using an array to store the cloned objects but it didnt work. im trying to make it so i can clone as many objects as i like without needing to give it an object number.

hope this makes sense

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Sep 2010 20:07
Quote: "hope this makes sense"

TBH, it doesn't. I put together something that at least will allow the creation and placement of blocks. I think what you would need would be an array that would store the contents of individual grid spaces, but then again, perhaps not.




If this is way different than what you are wanting to do, maybe you could elaborate some more. I do hope this is helpful.

LB

So many games to code.......so little time.
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 16th Sep 2010 00:39
im trying to make 2 player tetris racing. where each player uses tetris blocks to move forward. a block can only be placed as long as it is touching the players existing blocks on the grid already. (cant be randomly placed on the screen). there will be a slot reel with 4 slots at the top. the player spins the real and then gets the choice out of the 4 blocks (which ever block is spun on each reel) that they may use.

that is the basic operation of the game. with possibility of adding a few power-ups like blocking and going under your opponents blocks.

we have to prototype games for school and coding isnt my strongest suit. any kind of direction or input would be greatly appreciated
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 16th Sep 2010 17:35
Quote: "where each player uses tetris blocks to move forward"


By forward, do you mean away from (as on the Z axis) or upward (as on the Y axis)?

Quote: "a block can only be placed as long as it is touching the players existing blocks on the grid already."

Okay, so you will need some code to determine:
1. Is the current block touching an existing block(s)?
2. Check the actual x/y/z locations of the block to make sure it is consistent throughout the game (i.e. no blocks placed slightly off - correct the placement if it is).


Quote: "
there will be a slot reel with 4 slots at the top. the player spins the real and then gets the choice out of the 4 blocks (which ever block is spun on each reel) that they may use."

I would do this with sprites or perhaps 3D planes. If you don't have a 3D modeling program, you could always place the blocks on the screen (one at a time), grab the screen pic and trim it down to make images.

As an alternative, maybe you could simply write code that makes a series of random block numbers (stored in an array). The object that corresponds to the block number appears once the player places a block.

How does one win the game?

So many games to code.......so little time.
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 18th Sep 2010 08:30
this is what i have achieved so far.

player one can only place blocks on their own path and vice verse for player two. once a player has placed a block their turn ends. their is a countdown timer for each player but for some reason it has a mind of its own and player 1 or 2 might have 3 goes before its the next players turn.

when i rotate an already made object it appears that they all have a different pivot point? do you know why. block one moves nicely with the other starting block but some of the rest don\\\'t, this also changes when the object rotates.
i made one single block 20cm x 20cm x 20cm in 3ds max and used that dimension to make the rest.

do you know why the object rotation acts this way and why the players turn is doing what it does when the timer reaches zero.

the two integers in the middle of the screen represent which players turn it is. the top one is player one and the bottom is player two. a 1 will represent which players turn it is.

here is my code
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 18th Sep 2010 08:33
it wont let me post my code, i get a message saying bad language used, please edit it out??

do you know why
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Sep 2010 21:02
Quote: "when i rotate an already made object it appears that they all have a different pivot point?"


How you make it in your 3D modeling application will determine this. Make adjustments to it with relation to the x, y and z axis point and export it again.

Quote: "it wont let me post my code, i get a message saying bad language used, please edit it out??"


You can't cuss at it and expect to get anywhere

Seriously, log off the forum and log back in to see if it fixes the problem.

I'm not at my comp until tomorrow anyway, but plan to check back with you.

Computers do exactly what you tell them.........don't you hate that sometimes?
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 19th Sep 2010 02:24
it didnt work so i have tried attaching the code as a file

Attachments

Login to view attachments
boonsy
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 19th Sep 2010 02:26
i have tried adding my objects using the file applet uploader, its my first time so my apologies if it doesnt work
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 23rd Sep 2010 18:15
You have attached the t2.dbpro file, which will not work. You need to attach the t2.dba file. The forum does not seem to be having issues. Perhaps you could first try clicking on the CODE button, pasting your code and then clicking on the CODE button again to see if that works.

Computers do exactly what you tell them.........don't you hate that sometimes?

Login to post a reply

Server time is: 2024-11-24 11:17:48
Your offset time is: 2024-11-24 11:17:48