Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-10-2002, 07:22 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Small Movement Script

I started working on a movement script which lets you steer using the left/right keys and accelerate with up/down.
It's meant for underwater/swimming movement.
Do you people think that it's usable, or should I change it's behaviour?

NPC Code:
//#CLIENTSIDE
if (created) {
this.playerdir = 1;
timeout = 0.05;
}
if (timeout) {
disabledefmovement;
// Steering left/right
// Changing the dir
if (keydown(1)) this.playerdir += 0.05;
if (keydown(3)) this.playerdir -= 0.05;
this.playerdir = this.playerdir%2;
// Calculating the actual angle
angle = 3.14159265 * this.playerdir;
// Displaying the current direction
showimg 0,@tempus sans itc@cb@X,playerx+1.5+xmove,playery+2+ymove;
// Accelerating
// Calculating current direction
xmove = sin(angle);
ymove = cos(angle);
// Adding speed into a direction
if (keydown(0)) {
this.xspeed += xmove/5;
this.yspeed += ymove/5;
}
if (keydown(2)) {
this.xspeed -= xmove/20;
this.yspeed -= ymove/20;
}
// Limiting the speed
if (this.xspeed>0.5) this.xspeed = 0.5;
if (this.yspeed>0.5) this.yspeed = 0.5;
if (this.xspeed<-0.5) this.xspeed = -0.5;
if (this.yspeed<-0.5) this.yspeed = -0.5;
// Moving the player
playerx += this.xspeed;
playery += this.yspeed;
// Slowing down a bit
this.xspeed *= 0.99;
this.yspeed *= 0.99;
// Displaying the speed
setplayerprop #c,#v(this.xspeed) #v(this.yspeed);
timeout = 0.05;
}

Reply With Quote
  #2  
Old 07-10-2002, 08:01 PM
warp2ukew warp2ukew is offline
Prime Rib of Micronesia
warp2ukew's Avatar
Join Date: Feb 2002
Location: In a van down by the river.
Posts: 1,718
warp2ukew will become famous soon enough
sorry for double posting lol...it looks good though i just took a quick look at it
__________________
Reply With Quote
  #3  
Old 07-11-2002, 08:13 PM
Mista_Micro Mista_Micro is offline
Registered User
Join Date: Jun 2002
Posts: 168
Mista_Micro is on a distinguished road
i could use help with movement in my c++ game o.O
Reply With Quote
  #4  
Old 07-11-2002, 10:32 PM
bigkow44 bigkow44 is offline
Registered User
bigkow44's Avatar
Join Date: Dec 2001
Location: Inside my head.
Posts: 610
bigkow44 is on a distinguished road
Did anyone else noticed the angle is equal to 'pi'
__________________
Reply With Quote
  #5  
Old 07-12-2002, 06:45 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Radians are neat yes?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #6  
Old 07-12-2002, 08:49 PM
warp2ukew warp2ukew is offline
Prime Rib of Micronesia
warp2ukew's Avatar
Join Date: Feb 2002
Location: In a van down by the river.
Posts: 1,718
warp2ukew will become famous soon enough
Quote:
Originally posted by bigkow44
Did anyone else noticed the angle is equal to 'pi'
ya
__________________
Reply With Quote
  #7  
Old 07-13-2002, 12:25 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
Although it takes a bit of getting used to, it's pretty good. It strikes me as being kinda like the GTA1/2 motion system.
Reply With Quote
  #8  
Old 07-14-2002, 09:16 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
i notcied the PI thing also

thought it was just me
__________________
[signature]insert here[/signature]
Reply With Quote
  #9  
Old 07-15-2002, 02:25 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by screen_name
i notcied the PI thing also

thought it was just me
You seem to have a problem you need to take care of......before you end up in trouble....
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #10  
Old 07-15-2002, 08:20 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by adam


You seem to have a problem you need to take care of......before you end up in trouble....

o yeah, i thought i fixed that Xx
__________________
[signature]insert here[/signature]
Reply With Quote
  #11  
Old 07-15-2002, 09:25 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by screen_name



o yeah, i thought i fixed that Xx
good boy
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #12  
Old 07-24-2002, 11:07 AM
bigkow44 bigkow44 is offline
Registered User
bigkow44's Avatar
Join Date: Dec 2001
Location: Inside my head.
Posts: 610
bigkow44 is on a distinguished road
pi is 3.14 etc. in math terms, not 180 degrees.
__________________
Reply With Quote
  #13  
Old 07-24-2002, 10:05 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by adam
Radians are neat yes?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #14  
Old 07-26-2002, 12:08 AM
bigkow44 bigkow44 is offline
Registered User
bigkow44's Avatar
Join Date: Dec 2001
Location: Inside my head.
Posts: 610
bigkow44 is on a distinguished road
Quote:
Originally posted by Kaimetsu


True. Though we both know that they meant 3.14 radians are equal to 180 degrees.
yeah well its pi both ways
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:16 PM.


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