If you want a projectile to be destroyable like in the old coin -op : Karnov
where a rock appears on the hands of an enemy and then it is hurled towards the player,bounce at the ground for some seconds and fade- or explode
but you can shoot it,does it need to be a pawn?
I wonder how will make the rock pawn to bounce.If no one has an idea,and i wont manage it,then i will use projectile even if it wont be destroyable,unless the projectiles are updated to have health.
Destroyable Projectile
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Destroyable Projectile
It's possible to make a pawn bounce, at the moment i'm working on a project where I'm trying to imitate physics with scripts and I'm actually good at it
So for bouncing:
You'll need a variable, that stores the last Y position and another one, that stores the amount of Y the pawn has fallen during the last check. So it will be something like:
So now you have the speed, that the pawn goes down with. Now for the bouncing you can use that speed, multiplied by something, and apply it in a ForceUp() command.
So now I think it would be best to do this:
Often the things I do don't work from the first time, so try this and tell me if it works.
Also: you might ask why multiplying. Well, force_amount would be a really small value, 'cuz that's the amount of texels the pawn travels PER FRAME, and unless it's falling freakin' fast, it won't give a big value.
So for bouncing:
You'll need a variable, that stores the last Y position and another one, that stores the amount of Y the pawn has fallen during the last check. So it will be something like:
Code: Select all
if((self.current_Y < last_y) and self.IsFalling) //checks if the pawn is in the air and it's falling down
{
force_amount = last_y - self.current_Y;
}
So now I think it would be best to do this:
Code: Select all
if((force_amount > 0) and (self.IsFalling = false)) //if the pawn is no longer in air and there's a falling speed
{
ForceUp(force_amount*2);
force_amount = 0;
}
Also: you might ask why multiplying. Well, force_amount would be a really small value, 'cuz that's the amount of texels the pawn travels PER FRAME, and unless it's falling freakin' fast, it won't give a big value.