Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gravity/Jump n Run (https://forums.graalonline.com/forums/showthread.php?t=12674)

Knightoffrost 09-23-2001 05:16 PM

Gravity/Jump n Run
 
[ Delph Inc. ]
I have finished one of my little gravity/jump n run scripts...but I'm trying to make it so only one type of tile blocks you.
I've added in all the board script so 4 types of wall tiles don't block you but it stuffed the whole thing up.
Yes...you can now move up and down, left and right through these wall tiles...one thing though is that it doesn't let you go diagonal.
Also, now when you press the jump button whilst on a texture of these 4 tiles you just go up and don't come down. And when you hold down you come down.
It's very wierd and hard to explain. But I'm just wondering if anyone is out there who can speak my language and help me.

Thanks

KJS 09-23-2001 09:43 PM

well I can only under some of what your saying...

the keydown part...

for that you have to do it in seperate if/thens...

I beleve you have it like this right now
Quote:

if(keydown(0)){
you do your coding for moving up
}elseif(keydown(1)){
you do your coding for left
}elseif(keydown(2)){
you do your coding for down
}elseif(keydown(4)){
you do your coding for right
}
well insted of using

elseif

all the time just use 4 if's

like this
Quote:

if(keydown(0)){
you do your coding for moving up
}
if(keydown(1)){
you do your coding for left
}
if(keydown(2)){
you do your coding for down
}
if(keydown(4)){
you do your coding for right
}
mabie if you posted your code I can help you a little more but that is all I can help you right now

KJS 09-23-2001 10:29 PM

well if you use elseif
then your checking for 1 thing and if that thing is correct then it doesn't check for the rest...

yea you can make it shorter by using vecx and y

but I didn't think of that when I was typing it...

CyanideSR71 09-23-2001 10:53 PM

What exactly is vecx and vecy? Perhaps I use a different term...

KJS 09-23-2001 11:05 PM

Quote:

Originally posted by Kaimetsu

Usually you don't need it to check the second thing. Like I said, they can be mutual exclusive.

well if you say

if(keydown(blah)){

}elseif(keydown(blah)){

}

ect like I think he did

then the guy wont go diaganal like he was describing

LiquidIce00 09-23-2001 11:46 PM

if hes not making it diagonal then use elseif's
if hes making diagonal you need if (else you are going to do dual if checkings for keys .. stupid would just increase ur onwall crap)
also i never tried but if u wanna make 1 type of tile instead of using board use that new command in the new G2k1 2.1 the tiles(x,y) or something . I havent tested it but board is picky and needs whole numbers (no decimals) and tiles(x,y) might accept decimals (increasing the accuracy of your onwall)
=)

Knightoffrost 09-24-2001 04:59 AM

[ Delph Inc. ]
Board works fine and I can walk through only the 4 tiles I have specified but not Diagonal.
I will try the keydown thing again...it didn't work before and I might try something like:
if (keydown(playerdir)) {
playerx+=vecx(playerx);
playery+=vecy(playery);
}

That would work wouldn't it?
Could you give me some more on this tile(x,y) thing?
Or is it just like the 'in' command?

Quote:

Originally posted by CyanideSR71
What exactly is vecx and vecy? Perhaps I use a different term...
vecx and vecy are commands that have split the old dirgo array into a horizontal array (x) and a vertical (y) array.
e.g.
vecx contains this array {0,-1,0,1}
and vecy contains {-1,0,1,0}

So if you're using vecx and your NPC/player is facing left, you would get the result -1.

CyanideSR71 09-24-2001 05:06 AM

Ohhhh..... Gotcha!


All times are GMT +2. The time now is 08:28 AM.

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