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 / Prototype of my first game with loads of problems.

Author
Message
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 24th Aug 2004 06:01
--Have your name in the final version if you help debug this prototype------------------------------------------------------------

Here is my first proper game made with dbpro. The aim of the game is to touch all the cubes in the court to finish the level. There is no scoring system and no new levels or obstacles which will end the game, but like I said its just a prototype. I have a few problems though.

1.I cant seem to randomly place the cubes inside of the court.

2.I want to be able to make it look like the ball is rolling over
the court.

3.I want to optimize my code because I know there must be a better way than having hundreds of if statements.

ps. no comments sorry, its a prototype.

Thankyou I would really appreciate if someone spent the time to look through it or help me with one of the problems I have.

*For every problem you come across you gain something from correcting it, I hope.
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 24th Aug 2004 06:17 Edited at: 24th Aug 2004 06:18
Random positions:
numofcub=20
for i=1 to numofcub
position object i,rnd(1000)-500,0,rnd(1000)-500
next i

(assuming the cubes are created and with numbers from 1 to numofcub, they will be positionned in a zone of 500 units from the point 0,0,0 of your world)

My English is not so good I'm just French
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 24th Aug 2004 06:43
Thankyou, but the court is (x,z) (-125,0),(-125,125),(125,0),(125,125) and I used this code which I think should work but it doesnt.

Thanks for any more help you might give me

*For every problem you come across you gain something from correcting it, I hope.
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 24th Aug 2004 06:55
Then it will be:


My English is not so good I'm just French
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 24th Aug 2004 18:54
Thankyou for your help, it looks as though your code should work but it still doesnt work, I now have it so the cubes have a more random position(I put a wait command in), but like I said they still dont start off in the court. Please could you look over it again and see if there is something Ive missed. Thankyou, much appreciated.



Daniel.

*For every problem you come across you gain something from correcting it, I hope.
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 24th Aug 2004 19:00
sorted the problem. It should be position object t,rnd(126)-63,3,rnd(63)

Thankyou

Daniel.

*For every problem you come across you gain something from correcting it, I hope.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 24th Aug 2004 22:34
a better code would be

for t=7 to 12
repeat
position object t,rnd(126)-63,3,rnd(63)
until object collision (t,0)=0
next t

the repeat until loop makes sure that you dont get objects in the same place, it will repeat until no object occupies the same space as any other (most of the time it will succeed the first time) so you can`t get an object inside another or partialy inside another, it will only leave a object at a position that gives no collision.

Mentor.

PC1: P4 3ghz, 1gig mem, 2x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 25th Aug 2004 03:02
Excellent thankyou, do you know of any way I can shorten all of the collision detection commands like in a for next loop because when I create a new level im going to have extra cubes to get meaning i would have to add some more collision detection commands, it would be easier if i could just change the number in the for next loop so more cubes are created. I also want to have each level;s code in a different function because Im going to add more obstacles and that inda thing, so this is another reason why I need a shorter more efficient way to check for all the object collisions which can occur and need responding to. Thankyou for your help. Mentor - your name will go in the credits of the final version under volunteers. Thankyou again

Daniel.

*For every problem you come across you gain something from correcting it, I hope.
French gui
20
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 25th Aug 2004 04:51 Edited at: 25th Aug 2004 04:58
You can put these parts...


in 2 for...next:


...then for others levels you just have to change the numbers after FOR commands.

My English is not so good I'm just French
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 25th Aug 2004 05:51
Thankyou, I shall try that later, at work at the moment.

Daniel.

*For every problem you come across you gain something from correcting it, I hope.

Login to post a reply

Server time is: 2024-11-27 07:42:11
Your offset time is: 2024-11-27 07:42:11