Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Gravity Script. (https://forums.graalonline.com/forums/showthread.php?t=74884)

Remlin34 06-25-2007 05:46 PM

Gravity Script.
 
I need a gravity script. Its for a race.

Crow 06-25-2007 06:15 PM

You shouldnt request full scripts here. Kthxbye.

Angel_Light 06-26-2007 08:02 PM

search the forums theres already few out there. >_>

theHAWKER 06-27-2007 03:35 AM

Here you go its not my scritp, infact i have no idea why i have it xD
PHP Code:

//#CLIENTSIDE
if (playerenters) {
hide;
playerx=int(playerx);
playery=int(playery);
playerdir=3;
timeout=0.05;
theHAWKER.isKickAss true;
}
if (
timeout) {
if (!
antigravity) {
if (
keydown(0)&&playersprite>=1&&playersprite<=8playery+=0.5;
if (
playerdir==0||playerdir==2playerdir=gravdir;
if (
onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)) {
velocity=0;
playery=int(playery);
if (
keydown(6)) velocity=-2;

}
else if (
keydown(2)&&playersprite>=1&&playersprite<=8playery-=0.5;
if (
onwall(playerx+0.5,playery-0.1)||onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)||onwall(playerx+1.5,playery-0.1)) velocity=0.1;
else {
if (
velocity>-0.1&&velocity<=0velocity=0.1;
if (
velocity>3velocity=3;
}
if (
abs(velocity)>0) {
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)))||(velocity<0&&(onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)))) playery=int(playery);
else 
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)))||(velocity<0&&(onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)))) playery=int(playery);
else 
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)))||(velocity<0&&(onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)))) playery=int(playery);
else 
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)))||(velocity<0&&(onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)))) playery=int(playery);
else 
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(playerx+1.5,playery+3)))||(velocity<0&&(onwall(playerx+0.5,playery)||onwall(playerx+1.5,playery)))) playery=int(playery);
else 
playery+=velocity/6;
}
velocity+=abs(velocity/4);
if (
this.shot==9) {
hideimg 345;
this.shot=0;
}
if (
this.shot>0) {
if (
this.sd==1this.sx-=0.75;
if (
this.sd==3this.sx+=0.75;
showimg 345,busterl2d#v(this.sd).gif,this.sx,this.sy;
if (this.sd==1) {
if (
testplayer(this.sx,this.sy)>-2hitplayer testplayer(this.sx,this.sy),2,playerx,playery;
if (
testnpc(this.sx,this.sy)>-2hitnpc testnpc(this.sx,this.sy),2,playerx,playery;
if (
testcompu(this.sx,this.sy)>-2hitcompu testcompu(this.sx,this.sy),2,playerx,playery;
}
if (
this.sd==3) {
if (
testplayer(this.sx+1,this.sy)>-2hitplayer testplayer(this.sx+1,this.sy),2,playerx,playery;
if (
testnpc(this.sx+1,this.sy)>-2hitnpc testnpc(this.sx+1,this.sy),2,playerx,playery;
if (
testcompu(this.sx+1,this.sy)>-2hitcompu testcompu(this.sx+1,this.sy),2,playerx,playery;
}
this.shot++;
}
if (
playersprite==11&&playerhearts==playerfullhearts) {
this.shot=1;
this.sd=playerdir;
if (
this.sd==1) {
this.sx=playerx-2;
this.sy=playery+1;
}
if (
this.sd==3) {
this.sx=playerx+2;
this.sy=playery+1;
}
showimg 345,busterl2d#v(this.sd).gif,this.sx,this.sy;
}
if ((
keydown(0)||keydown(2))&&!(keydown(1)||keydown(3))) playersprite=0;
if (
keydown(1)&&!keydown(3)) playerdir=1;
if (
keydown(3)&&!keydown(1)) playerdir=3;
gravdir=playerdir;
}
timeout=0.05;
}
if (
created) {
if (
keydown(6)) {setani jumpnrun,;}


but its in gs1 :P

coreys 06-27-2007 08:25 AM

Gravity never seemed like a hard thing to script, to me, but then again I've never tried.

TheJames 06-27-2007 08:47 AM

Era's gravity.
 
Quote:

#CLIENTSIDE
if (created) {
this.gravspeed = 0.45; //Fall Speed
this.jumpheight = 1.5; //Jump height to reach
this.jumpspeed = 0.4; //Raise Speed in jump
this.jumpdelay = 0.6; //Jump interval (S)
}
if (playerenters || timeout) {
if (!onwall(playerx+0.5,playery+3+this.gravspeed) && !onwall(playerx+1.5,playery+3+this.gravspeed)) playery+=this.gravspeed;
else {
for (i=10;i>0;i-=1;) {
if (!onwall(playerx+0.5,playery+3+((this.gravspeed/10)*i)) && !onwall(playerx+1.5,playery+3+((this.gravspeed/10)*i))) {
playery+=(this.gravspeed/10)*i;
break;
}
}
}
if (keydown(6) && this.jump==false && playerz==0 && this.jumptick==0) {
this.jump=true;
for (this.i=0;this.i<=this.jumpheight;this.i+=this.jum pspeed;) {
playerz+=this.jumpspeed;
setplayerprop #c,Y: #v(this.i);
sleep 0.05;
}
this.jump=false;
this.jumptick=this.jumpdelay;
}
if (playerz>0) playerz-=this.gravspeed;
else playerz=0;
if (this.jumptick>0) this.jumptick-=0.05;
timeout=0.05;
}
Era's gravity script. Enjoy! The ;)'s = ; ) put together.

theHAWKER 06-27-2007 06:45 PM

Quote:

Originally Posted by TheJames (Post 1323026)
Era's gravity script. Enjoy! The ;)'s = ; ) put together.

yet its in gs1 again...

DustyPorViva 06-27-2007 08:31 PM

Hmm, the first one is just old... unoptimized and long. The first one... doesn't work very well. The 'physics' are bad, and you can't really jump up, so it's only good for if you stay on the platform.


All times are GMT +2. The time now is 09:46 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.