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 / Random object positioning

Author
Message
Alvind
14
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 23rd Nov 2013 21:22
Hi guys I'm having abit of bother finding some info/documentation on placing objects (eg. Crates) randomly around a level. I did spy it in a tutorial somewhere but I cannot find it. It was something like:

For x = 1 TO 8
Blah blah etc.
Next x

Any help will be great, I've a feeling it won't be the first time I have a question

http://dai.moddb.com
luskos
14
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 23rd Nov 2013 22:35 Edited at: 23rd Nov 2013 22:35


Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Alvind
14
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 23rd Nov 2013 22:46 Edited at: 23rd Nov 2013 22:59
Thanks luskos! I have a real noob question. How do I apply that code to the object number?

http://dai.moddb.com
BatVink
Moderator
19
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Nov 2013 23:04
The code assumes your objects are numbered 1 to 8, it's the "i" in the position object command.

Alvind
14
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 23rd Nov 2013 23:08 Edited at: 23rd Nov 2013 23:13
I'm looking multiple crates randomly placed. Apologies if I didn't say it clearly

http://dai.moddb.com
luskos
14
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 24th Nov 2013 09:40
I think you need to go small.If you struggle to understand a code as simple as positioning few objects at random, you might just aim too high.Make text adventure game, then make 2d game, tic tac toe, pong etc., then you can make something simple but still challenging in 3d.My first 3d game was rubik cube.A game of strong logic.You can try checkers.Pick up skills while you make these games.You need to have some base first.Start with something you can actually finish, i hate to say this but i think your project is a fail from the start.Do not be discouraged if you fail to deliver the game you dream for.A lot can be learned from fails.Find some tutorials, read about game making practices, planing and stuff like that.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Alvind
14
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 24th Nov 2013 11:53
I know what you are saying. I'm using my project as some things that I've learnt so far and I am working my way through the tutorials. So it's in no way a dream game lol. I'm finding I can read code and understand it ALOT more than I can remember how to write it from memory ATM.

http://dai.moddb.com
Alvind
14
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Northern Ireland
Posted: 24th Nov 2013 14:00 Edited at: 24th Nov 2013 14:03
Ok so I got sorted on arranging the crates randomly and now ive got that under my belt. my next enquiry is that when I go to fiddle with the OBJECT COLLISION IF statements its saying that the object at line 177 (i) doesn't exist? anyone shed any light? and also how can i stop overlapping?



http://dai.moddb.com

Attachments

Login to view attachments
luskos
14
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 24th Nov 2013 22:38 Edited at: 25th Nov 2013 13:18
IF (OBJECT COLLISION(2,4) > 0) OR (OBJECT COLLISION(2,i) > 0) <(line177)
Object collision between 2 and 4 is fine.But between 2 and "i" is not.
Instead of using "i", you can use (OBJECT COLLISION(2,0), it will check for collision with any object.

For the overlapping you can use distance check when you place a new crate against the other crates, if the distance is too small replace until there is no overlapping.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2022-06-27 07:25:50
Your offset time is: 2022-06-27 07:25:50