O Ilusionista
Captain 100K
ah, if your version doesn't support sin, I don't think it would be able to run the code.
I though maybe is an error cos BloodBane used it in his Contra mod.
Goliath said:I was askinig if you know how to write the sin function, to implement it on the current BOR version i´m using, nothing more.![]()
White Dragon said:If you want to do a curve motion without sin/cos use bezier curve!
Goliath said:White Dragon said:If you want to do a curve motion without sin/cos use bezier curve!
Can you give a code example of How to draw a Bezier curve given 3 points?
White Dragon said:Some post above I done an example for cubic curve. You use quadric curve
#include "data/scripts/beziercurve.h"
void main() {
void self = getlocalvar("self");
if (openborvariant("in_level") && getentityproperty(self,"animationid") != openborconstant("ANI_SPAWN")){
if ( getlocalvar("bezier_time") <= 1 || getlocalvar("bezier_time") == NULL() ){
float t = getlocalvar("bezier_time"),x,a;
float b = getentityproperty(self, "base");
float speed = 0.005;
if (t == NULL()) setlocalvar("bezier_time",0);
else setlocalvar("bezier_time",getlocalvar("bezier_time")+speed);
t = getlocalvar("bezier_time"),
x = bezier_curve(t,3,0,100,200,300);
a = bezier_curve(t,3,b+0,b+144,b+144,b+0);
changeentityproperty(self,"position",x,223,a);
drawstring(10,100,0,"t: "+t);
drawstring(10,110,0,"x: "+x);
drawstring(10,120,0,"y: "+a);
}
}
}
Goliath said:I didn´t change the time from your test script, only speed and coords:
Code:#include "data/scripts/beziercurve.h" void main() { void self = getlocalvar("self"); if (openborvariant("in_level") && getentityproperty(self,"animationid") != openborconstant("ANI_SPAWN")){ if ( getlocalvar("bezier_time") <= 1 || getlocalvar("bezier_time") == NULL() ){ float t = getlocalvar("bezier_time"),x,a; float b = getentityproperty(self, "base"); float speed = 0.005; if (t == NULL()) setlocalvar("bezier_time",0); else setlocalvar("bezier_time",getlocalvar("bezier_time")+speed); t = getlocalvar("bezier_time"), x = bezier_curve(t,3,0,100,200,300); a = bezier_curve(t,3,b+0,b+144,b+144,b+0); changeentityproperty(self,"position",x,223,a); drawstring(10,100,0,"t: "+t); drawstring(10,110,0,"x: "+x); drawstring(10,120,0,"y: "+a); } } }
O Ilusionista said:Better sugestion: update your OpenBOR.
For the first one, I am using it in Storm's hurricane