PDA

View Full Version : Legend movement preview

excaliber7388
10-18-2006, 01:31 AM
A preview of the script I plan to use for the movement. There will be variations for speed, and the distance you travel after you let go of the button (for flying and other vehicles) but this is a general idea of what it will be like. It's pretty smooth, but I'm working on it even better. Also, this is in GS1 just so you can test it off line. What do you think?

if(created)
{
freezeplayer .05;
timeout = .05;
}
if(timeout)
{
if(this.count==1)
{
this.cx=mousex-.5;
this.cy=mousey-.5;
this.count=0;
}
this.count++;
showimg 1000,dr-crosshairs.png,this.cx,this.cy;
freezeplayer .05;
if(keydown(0))
{
playerx+=.75*sin(this.ang*(3.14/180));
playery-=.75*cos(this.ang*(3.14/180));
}
if(keydown(2))
{
playerx-=.75*sin(this.ang*(3.14/180));
playery+=.75*cos(this.ang*(3.14/180));
}
if(keydown(1))
{
if(abs(playery-mousey)>abs(playerx-mousex))
{
playerx-=.75*cos(this.ang*(3.14/180));
}
else
{
playerx+=.75*cos(this.ang*(3.14/180));
}
if(abs(playery-mousey)>abs(playerx-mousex))
{
playery+=.75*sin(this.ang*(3.14/180));
}
else
{
playery-=.75*sin(this.ang*(3.14/180));
}
}
if(keydown(3))
{
if(abs(playery-mousey)>abs(playerx-mousex))
{
playerx+=.75*cos(this.ang*(3.14/180));
}
else
{
playerx-=.75*cos(this.ang*(3.14/180));
}
if(abs(playery-mousey)>abs(playerx-mousex))
{
playery-=.75*sin(this.ang*(3.14/180));
}
else
{
playery+=.75*sin(this.ang*(3.14/180));
}
}
timeout = .05;
}

Crono
10-18-2006, 02:33 AM
hot

wait wtf it's like buggy

if i press left sometimes it goes right and starts bouncing and **** x_X!

excaliber7388
10-18-2006, 03:12 AM
Yeah I know, there are some bugs. For left/right, try to keep the mouse in the same spot, and don't get to close. Also, I wouldn't press up or doan and left/right at the same time. I'm still working on this ;)

Gambet
10-18-2006, 04:50 AM
Well, I hope you can pull off a bugless serversided movement system. This current version has plenty of problems.

Twinny
10-18-2006, 05:04 AM
Well, I hope you can pull off a bugless serversided movement system. This current version has plenty of problems.

Way to help him out >_<

excaliber7388
10-18-2006, 05:12 AM
I think I'm going to make it edit your direction when you get cose to an edge that might make you shake. The current version is clientside, but it'd be a similar script serverside.
The math+smoothness is what I'm going for here

jake13jake
10-20-2006, 05:01 AM
Well, I hope you can pull off a bugless serversided movement system. This current version has plenty of problems.
Do you mean custom movement system? Serverside player movement would detract so much from gameplay that I wouldn't even look into it.

excaliber7388
10-20-2006, 05:58 AM
Do you mean custom movement system? Serverside player movement would detract so much from gameplay that I wouldn't even look into it.
Oh yeah...damn...I should have pointed that out lol.

Anyway, have a much more complex system now, in gs2, with variable speed and 'drift' (the amount of time you comtinue in the same direction after you have pressed the button, this is for use with different vehicles, or terrain, such as ice, space, mud, etc).

wild8900
10-24-2006, 04:17 AM
Oh, by a glance at the code, I take it that this is the topdown shooter server you told me about? Sounds really fun, when will the server be playable to the public?

Btw,
I was working on a 360 degree car system with fine collision (sliding across walls too) detection. Ill post part of it for people to use. Its GS1 thought because I test it out in the editor (just an excuse to not learn GS2).

If anyone wants me to, I can post an edited one that allows straifing (and moving forward at same time).

//If used, please give credit to me, wild8900 (or my persona, Irata)
//This is the basic collision and movement script.
//The collision is based around a centered point.
checky = y+sin((360-direction)*(3.14159/180))*speed;
checkx = x+cos((360-direction)*(3.14159/180))*speed;
if (!onwall(x, checky)) {
y = checky;
}
if (!onwall(checkx, y)) {
x = checkx;
}

jake13jake
10-24-2006, 06:10 AM
Yea, I have a lot of good movement functions down in GS2 if you'd want to convert. Definitely makes it a lot easier. movedx (with wallcheck) movedy (with wallcheck) moveobj(tiles,dx,dy,object). tiles being an array of tiletypes to be considered walls. The trick is to add up the amount of distance you'd want to move in terms of x and y as separate variables and then putting it in the function. These functions can be integrated onto any existing movement system as well (won't make you go through walls unless your other movement is fundamentally flawed)
http://graal.net/snippet/detail.php?type=snippet&id=88

A few variables you'd want to define in your weapon NPC containing this script though (people often forget to).

this.offx (offset from natural x value of character/object to the point where you want to block)
this.offy (offset from natural y value of character/object to the point where you want to block)
this.w (width of the area being blocked)
this.h (height of the area being blocked)

you can change these if you want to do multiple movements of an object in the same script.