James Bond the Dinosaur

Blitz3D Forums/Blitz3D Beginners Area/James Bond the Dinosaur

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

That's it??!?! That's pretty short code for a FPS....
Well, there isn't any code for enemy AI yet, but you could call it a First Person Shooter at this point I guess (although there's absolutely no bells & whistles).

how would I check to see if the "badguy" is not placed inside a wall of the level?
Well, there is no easy solution. The one you suggested would work per say, but wouldn't be very efficient (it may have to try 1268 times before it gets it right...). Also it wouldn't be very efficient because you are starting over from the beginning each time. A better solution would be to create a REPEAT-UNTIL loop that keeps trying until the current guy is placed.

[pseudocode]
Repeat
MoveEntity badguy, Rnd(100), Rnd(100), Rnd(100)
Until EntityCollided(badguy, level) = False
[/pseudocode]

Also, what if a badguy ends up on the OUTSIDE of a level? How does your code tell the INSIDE from the OUTSIDE?
Or what about this scenario:
B=badguy P=player

     outside
 +------------------+
 |  B      B        |
 |     P            |
 |          inside  |
 |   +----+         |
 |   | out|         |  outside
 |   |side|         |
 |   |  B |    B    |
 |   +----+         |
 | B                |
 +------------------|
           outside
The badguy is inside the boundary of the game, but not in the playing area.


One possible solution could be to start at a known good location (or several good locations) inside of the level and then randomly move the badguys around for a while with Collisions enabled. That way, they can't end up on the outside or within a wall.

or you could just hard code in starting positions for the badguys,

or you could create starting "zones" within your level by inserting huge hidden cubes in your level where the zones are. If the badguy isn't touching a zone (one of the hidden cubes) then try moving him somewhere else.

I guess it's up to you.