[Help] damage function

Post your tutorials here.

[Help] damage function

Postby daniel1296 » Mon Mar 12, 2012 11:36 am

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 Beyblade game that i did and Wrestling game.. two of them very spacial..
this what i have now-
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
    }
}

i want to replace the "math.sin" function with much better function .. plz any idea :)
daniel1296
 
Posts: 15
Joined: Fri Dec 30, 2011 9:31 pm

Re: [Help] damage function

Postby Kilinich » Mon Mar 12, 2012 12:47 pm

1) you need to read velocities with (readable(e.this)).vel (readable(e.other)).vel
2) you need to get weight via density and size (or another way)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: [Help] damage function

Postby daniel1296 » Mon Mar 12, 2012 1:30 pm

umm u can write it for me? i dont exacly understand what u write..
daniel1296
 
Posts: 15
Joined: Fri Dec 30, 2011 9:31 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests

cron