PDA

View Full Version : Fast Sword Beam



Mega Link
06-17-2008, 01:55 PM
I want to have a "Lightning Sword", but I can't find out how to change the speed of the sword beam on a per-item basis.

bigjoe
06-17-2008, 01:58 PM
Don't know if you can. I could maybe write a script for you though, if you were to accept it in the form of a script. It's a two or three liner.

Joe123
06-17-2008, 02:09 PM
item script swordbeam{
void run(int sp, int dm, int t, int c, int f, int fs){
int d = Link->Dir;
int x; int y;
if(f == 0) f = 1;
lweapon s = Screen->CreateLWeapon(2);
s->OriginalTile = t+d*f;
s->Tile = t+d*f;
s->CSet = c;
s->NumFrames = f;
s->ASpeed = fs;
s->Dir = d;
s->Damage = dm;
s->Step = sp;
if(d>1) x = (((d-2)*2)-1)*16;
if(d<2) y = ((d*2)-1)*16;
s->X = Link->X+x;
s->Y = Link->Y+y;
}
}

Tiles must be set up 'Up, Down, Left, Right' on the tilesheet.
You have to set them all up, the script doesn't use flips or anything silly like that.
D0 : Speed of sword beam
D1 : Damage of sword beam
D2 : First tile of sword beam sprites in tilesheet
D3 : Cset of sword beam
D4 : Number of frames of animation
D5 : Speed of animation

Mega Link
06-17-2008, 02:10 PM
Don't know if you can. I could maybe write a script for you though, if you were to accept it in the form of a script. It's a two or three liner.
I'm fine with that. When my game is finished, you'll be on the credits list.

Edit: Never mind, Joe123 replied 1 sec. before I did.

bigjoe
06-17-2008, 03:14 PM
Eh, mine would have been more simple and just replaced the sword beams based on the level of the last sword swung. But that works too and is actually a bit more flexible.

Joe123
06-17-2008, 03:29 PM
Oh, you'dve loaded the sword beams already on the screen and changed their speeds?

I'd never have thought to do that.

Mega Link
06-17-2008, 04:55 PM
Ummm... Could you make it so that the beam "explosion" uses separate tiles?
Like this: UP; DOWN; LEFT; RIGHT; UP, LEFT; UP, RIGHT; DOWN, LEFT; DOWN, RIGHT.

Joe123
06-17-2008, 06:00 PM
Beam explosion?

This script doesn't have anything to do with beam explosions, I don't know how they work, sorry.
I don't think they're too easy to script up; they're rather hard coded I believe.

_L_
06-17-2008, 11:18 PM
Beam shards (as they are more properly known) consist of the third and fourth tiles in the sword beam's weapon sprite. You can't change that.

Joe123
06-18-2008, 03:06 AM
Although you could change the sword beam's graphic just before it became invalid, so that it used the tiles you wanted, right?