hi! friends!!
how can i create the enemy in a random way?
just like fighter plane in the game ,fly to you.
which function should i use ?
i am newbie please help me.
thank you!!
how to create the stochastic enemy ?
-
- Posts: 31
- Joined: Mon Sep 05, 2005 4:47 pm
- Contact:
You just need to wait for the correct audience.
What are you trying to do? Create a plane then have it fly to you?
What are you trying to do? Create a plane then have it fly to you?
GMan
Black Ninja Games
Black Ninja Games
If I read your question correctly, you're not going to make it happen with a single "built in" function. It's going to be a collection of functions and procedures. And there are going to be many ways of doing it, depending on what you're trying to achieve.how can i create the enemy in a random way?
I would suggest you read the Irrlicht docs and study the examples more...
hi thank you!!
i love this forum.
i am chinese,so my meaning express in a difficult way
i use (gettimer()->gettime()%50) ,but when this condition happen then create a lot of plane and they not random.
i want to find a condition,when it happen the plane will be create.
the condition will happen in a random way.
i dont know if i have say my question expressly
thank you for your help!!
i love this forum.
i am chinese,so my meaning express in a difficult way
i use (gettimer()->gettime()%50) ,but when this condition happen then create a lot of plane and they not random.
i want to find a condition,when it happen the plane will be create.
the condition will happen in a random way.
i dont know if i have say my question expressly
thank you for your help!!
you want to use rand to get a random number.
here's one way of doing it...
here's one way of doing it...
Code: Select all
#include <stdlib.h> // include rand
// first you set the 'seed'
// each seed gives a different sequence of numbers
// setting it to the timer makes it seem more random
srand(getTimer()->getTime());
// we need to control the frequency of the check
if (one_second_has_passed)
{
// rand() gives a random number
if (rand() % 100 < 5) // 5% chance
{
// new enemy every (100/5=)20 seconds on average
}
}