Page 1 of 1

[Help] damage function

PostPosted: Fri May 25, 2012 9:30 am
by daniel1296
Hi everybody.. umm this question is a littlebit difficult,
i want to do a function that when polygon hit another polygon, the damage will reduce due to velocity and weight.
i need it to Wrestling game that i did..
this what i have now in the oncollide-
Code: Select all
(e)=>{
    scene.my.blue > 0 ? {scene.my.blue := (scene.my.blue - (2 + 2 * math.sin(sim.time * 2)))} : {
        e.this.density := 60;
        e.this.color := [0, 0, 0, 1];
        scene.my.blue := 0
    }
}

this is my scene-
Rating: rated 4.5
Filesize: 0.57 MB
Comments: 2
Ratings: 2
download

i want to replace the "math.sin" function with much better function.
*I tried this
Code: Select all
(e)=>{
    x := (readable(owner)).vel(0);
    y := (readable(owner)).vel(1);
    {x < 0} ? {x := x * (-1)} : {};
    {y < 0} ? {y := y * (-1)} : {};
    {scene.my.green > 0} ? {scene.my.green := scene.my.green - (x * y)} : {density := 0}
}

(But i dont know why, i think x / y, dont change there direction, because when object goes left, x is -x and then -x*y
result= -(x*y) but i change it!
Code: Select all
{x < 0} ? {x := x * (-1)} : {};

and then health increase instead of decrease)
I cant take Speed and thatz it??
Hope you understand my problem..
plz if anyone can write this function for me it will be nice. (sorry for my bad english)