I’m making an FPS game and I want to have objects flying in the air and attacking my character in some sort of random way. I’m quite new to the BGE so I don’t know the best way to do this.
Can it be done with a particle system? I want to be able to shoot the objects so I don’t know if this will allow it.
I don’t want the objects to be flying on the same paths every time, or the game will get boring very quickly. If I have to learn some python script to do this, I’ll try that, even though I’m new to python as well (but not to programming).
Draw a cuboid, I mean an abstract one. You need two XYZ vectors, one for the origin and another for volume. Now dice roll three floats within range of these bounds, and you get spawn point coordinates. Dice roll again, and you get the coordinates for a goal to fly to. Track to goal, get there, re-reroll. Rinse and repeat.
Note how I added an optional offset parameter to randPointInside(). That’s one way to make sure the new coordinate is at least offset far enough from the last. You may come up with something less verbose yourself.
Final note, if the flying objects can collide with each other then you’re in for a good time. I don’t know if the built-in obstacle avoidance is going to be much help here and python isn’t the best fit for writing out your own.
Eh, might not be the best term as definitions vary. I mean strictly a cubical shape whose points are not equidistant, that is to say the edges along each axis are not the same length. In other words, the tridimentional equivalent of what a rectangle is to a perfect square.
um i’d just generate them using random module, and calling them into the scene( then you can keep using the same obj over and over which) use a raycast to remove obj from that scene. and have a cube so if anything collides with cube it gets removed from scene e.g. deleted. simple really.
Well I just want some enemy objects to be flying on random courses through the air, attacking my player. Maybe not even random courses, but instead spawning at ransom locations but not flying directly (straight line) to the player. I was thinking of like the way boids act. I actually want to use boids if possible.
then set your enemy object to “seek” the player using logic bricks.
if you’d like them to follow a specific course there’s many ways you can do that, one of which is to set a path they follow, another is to physically code in a pattern, for truly random code you’ll have to get further in depth.