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 06-03-2002, 09:42 PM
Gohan43331 Gohan43331 is offline
Registered User
Join Date: Jan 2002
Posts: 87
Gohan43331 is on a distinguished road
Send a message via AIM to Gohan43331
Snake? Array questions and more...

Alright, I had the sudden urge to go make snake...Don't ask...

Now i feel totally lost...I have a basic script down that changes directions and all that, but I need help with altering the array so that 1 of them is a turning piece...

Ex: you change dir from 3 to 0, the spot that the head is on is now a turning piece and the head is now facing 0. When I tried to alter the array to turn, it moved the whole body up...

I am not a math techie...So this is a bit hard for me :-/
Script:
NPC Code:

if (playerenters) {
toweapons Frogger;
this.active=0;
}
if (weaponfired && this.active==0) {
freezeplayer .6;
playerdir=0;
setani idle,;
this.active=1;
this.dir=3;
this.head={4,9};
this.tail={0,9,1,9,2,9,3,9};
this.dirgo={0,-1,-1,0,0,1,1,0};
timeout = .05;
}
if (timeout && this.active==1) {
freezeplayer .6;
setani idle,;
for (this.i=0;this.i<arraylen(this.tail)/2;this.i++) {
this.tail[this.i*2]+=this.dirgo[this.dir*2];
this.tail[this.i*2+1]+=this.dirgo[this.dir*2+1];
}
this.startx=screenwidth/2-200;
this.starty=screenheight/2-100;
showimg 800,snakegrid.gif,(this.startx),(this.starty);
changeimgvis 800,4;
showimg 801,snakehead.gif,(this.startx+this.head[0]*32),(this.starty+this.head[1]*32);
changeimgvis 801,4;
for (this.i=0;this.i<(arraylen(this.tail)/2);this.i++) {
showimg 802+this.i,snakebody.gif,(this.startx+(this.tail[this.i*2]*32)),(this.starty+(this.tail[this.i*2+1]*32));
changeimgvis 802+this.i,4;
}

if (keydown(0) && this.dir!=2) this.dir=0;
if (keydown(1) && this.dir!=3) this.dir=1;
if (keydown(2) && this.dir!=0) this.dir=2;
if (keydown(3) && this.dir!=1) this.dir=3;
sleep .5;
timeout = .05;
}



I'll post the images in the next 2 posts (and this one)
Attached Images
 
__________________
Reply With Quote
  #2  
Old 06-03-2002, 09:44 PM
Gohan43331 Gohan43331 is offline
Registered User
Join Date: Jan 2002
Posts: 87
Gohan43331 is on a distinguished road
Send a message via AIM to Gohan43331
The grid (*curses 30 sec timer*)
Attached Thumbnails
Click image for larger version

Name:	snakegrid.gif
Views:	178
Size:	4.0 KB
ID:	16699  
__________________
Reply With Quote
  #3  
Old 06-03-2002, 09:46 PM
Gohan43331 Gohan43331 is offline
Registered User
Join Date: Jan 2002
Posts: 87
Gohan43331 is on a distinguished road
Send a message via AIM to Gohan43331
And finally, the head (and don't worry about the images...i'll have multi-dir ones soon...These are just temporary)
Attached Images
 
__________________
Reply With Quote
  #4  
Old 06-03-2002, 10:46 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
=D

lol, i've already got one made, just have to fix it up a bit so i can have fruit and stuff


it was hard to make the bord corners, but i finally got it
__________________
[signature]insert here[/signature]
Reply With Quote
  #5  
Old 06-03-2002, 10:55 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
sorry kai for the double post


and from your script, i doubt you'll figure it out =D
lol
__________________
[signature]insert here[/signature]
Reply With Quote
  #6  
Old 06-04-2002, 11:13 AM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
Quote:
Originally posted by screen_name
sorry kai for the double post
Why apologize? Why double post in the first place? This is what the edit button is for.
Reply With Quote
  #7  
Old 06-04-2002, 06:38 PM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
You don't really need math to make it, just make one array which stores the position of the current body parts, make it the size of the maximum number of body parts, and then make a variable which keeps track of which part of the array needs to change.
__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
  #8  
Old 06-04-2002, 09:11 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
Quote:
Originally posted by Spanko
You don't really need math to make it, just make one array which stores the position of the current body parts, make it the size of the maximum number of body parts, and then make a variable which keeps track of which part of the array needs to change.


lol, it seems it would be that easy write??

well if you use corners then you have a problem...

=D
__________________
[signature]insert here[/signature]
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 08:48 PM.


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