kinda collison detection...

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

kinda collison detection...

Post by sid6.7 »

okay here we go...

there is a tank game made by someone else
the map you play on has boxes pyramids and
teleporters...

what i am trying to do is make a random map maker
for it..so far it works for the boxes and pyr's fine even
if the get placed on the same or close to the same spot
the game allows them to merge into one object....

BUT

for teleporters this is not good if a tele is buried inside
a box or pyr you can't get to it...

i'm am trying to find as easy of a way to place teles randomly
on the map without dropping them inside something i think
i know what i have to do but i might be doing it the LONG way
and am seeking a shorter soltuion...

here is the format of the boxes and pyrs in the map file:

box
position -69 -196 0
rotation 3
size 43 8 22
end

pyramid
position -328 134 0
rotation 26
size 14 3 12
end

position is the part i am having to look at
its X axis Y axis and Z on the map Z being how hi off the floor it is...


here what a teleporter would be like in the file:

teleporter
position -132 -346 0
rotation 144
size .125 10 10
border 1
end

again position is the part i am looking at ignore the rest...

the position is all generated by this formula

X Y or Z = int(rnd * 800) -399 the map is 400 x 400 units wide/tall

when i generate a position for the teleport what would be the easiest
way to not place it right on top(inside) of a box or pyr...

here is a screen shot of what a map looks like made with my random
map maker so far...

Image
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

I would save the location of boxes and pyres..
Then make sure the player was placed a certain distance from them..

If a box can only be max 100 wide or long.. and a pyre can only have a max radius of 40.. then you should make sure the player is more than 100 away from any pyre or box
I have left this dump.
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

Z!re wrote:I would save the location of boxes and pyres..
Then make sure the player was placed a certain distance from them..

If a box can only be max 100 wide or long.. and a pyre can only have a max radius of 40.. then you should make sure the player is more than 100 away from any pyre or box

thanks that helped me zire...

basically when i write the box or pyr to the map
i then also wrote the coordinates to a seperate tracker file...then
when i make the teles i check that file.............
i think i need to do it different or MORE as it still
puts 1 of 8 teles inside a block cuase of the size thing
calulating the size of the object at XYZ then moving
the tele outside that is very hard so far...probably outside
my skill as of yet...
Post Reply