How to get a better randomization
bravery
Member, PRO Posts: 35
Hello,
I have a fly that throght bombs on my player and I want the bombs to be near explod almost near my player place, so I add the the bombs an Accelerate Toward action, and in the filed "accelerate toward the point" I add the following expression:
game.PlayerX + random(-200,200)
where game.PlayerX is the current player x position.
However the problem is that the bombs is almost hit the player and very rare bombs explode beside it, so how can I make this random operation happen better, where what I want is most of the time the bombs explode beside the player (either in front of player or back of the player) and rare bombs hit him directly.
Please advise.
I have a fly that throght bombs on my player and I want the bombs to be near explod almost near my player place, so I add the the bombs an Accelerate Toward action, and in the filed "accelerate toward the point" I add the following expression:
game.PlayerX + random(-200,200)
where game.PlayerX is the current player x position.
However the problem is that the bombs is almost hit the player and very rare bombs explode beside it, so how can I make this random operation happen better, where what I want is most of the time the bombs explode beside the player (either in front of player or back of the player) and rare bombs hit him directly.
Please advise.
Comments
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Can anyone help more about that?
(Game.player.X - 30) + random(-200,200)
Increase or decrease the -30 until you get what you want.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
is there a way to say something like:
if(random(1,3)=1) then
do
....
else
....
The problem is that I can't set a random function inside a condition so can you tell me how should I do this?
Thanks
If attribute = random (1,3) [then do some stuff]
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS