Samus' Power Beam
#16
Posted 16 August 2008 - 06:24 PM
I'll get back to you in a couple days...
...and with that, I'm off to bed.
#17
Posted 16 August 2008 - 07:06 PM
1: Gun fires when key is both pressed, and released.
2: When the fire button is being held down, Samus may only move the current direction she is facing.
3: The actual shot starts 16 pixels away from the Samus sprite
4: The charging doesn't work.
EDIT: That was weird.
When I first start up the game, the press and release fire thing, doesn't happen for the first 4 shots or so... then it starts to be buggy...
#18
Posted 17 August 2008 - 02:57 AM
3: The actual shot starts 16 pixels away from the Samus sprite
Those are intentional, I thought they were quite nice....
Did you want the shot to start on top of Samus?
I always thought that looked horrible...
#19
Posted 17 August 2008 - 08:09 AM
Maybe as soon as the charging works, that I'll like Samus' inability to move in any special direction while charging.
Also, I wonder if there's a script that can decrease enemy daze time, to like a quarter to a half of what it is... that would make this beam so much more useful.
I'm not asking you to make it... well, I am... but you don't have to do it if it's complex or whatever... well, you don't have to do it period. But it would really help.
#20
Posted 18 August 2008 - 04:20 PM
#21
Posted 19 August 2008 - 01:46 PM
When you said 'Samus can only move in one direction while charging', I read it as 'Samus can only face in one direction while charging'.
You're meant to be able to move in all four directions, just only face in one direction.
Oops.
And after trying out this script, it's a complete mess.
So I think I'm going to start over.
This is what happens when I try to code something over-complicated from scratch without even testing it >_<
And I'm afraid that enemy script isn't really feasable, although I'd be happy to look into any other scripts you wanted.
Hopefully I'll be able to get this one sorted within the next couple hours.
EDIT:
Ah, only took me 35 mins too =)
It wasn't as bad as I thought, I'd just forgotten to reset a variable.
Similar to what you said P_C, but not quite.
Thanks anyway though.
So, here we go:
//Inputs
const int Beam1Tile = 0; //Tile for the un-charged beam to use
const int Beam1Frames = 0; //No. frames of animation
const int Beam1Speed = 0; //Speed
const int Beam2Tile = 0; //Tile for charged beam to use
const int Beam2Frames = 0; //No. frames of animation
const int Beam2Speed = 0; //Speed
const int BeamCset = 8; //Cset for the beams to use
const int BeamChargeSFX = 35; //Sound effect to play when beam is fully-charged
const int BeamSFX = 2; //Sound effect to play when beam is fired
const int NoTurn = 1; //If greater than 0, Samus cannot turn to face a different direction whilst charging up the beam. If set to 0, she can turn around. This only works with Diagonal Movement on.
const int DistFromSprite= 8; //The number of pixels away from Samus the projectile is fired from. Default 8, set it up how you will.
const int BeamSpeed = 3; //Speed for beams to fly at goes here
const int Beam1Damage = 2; //Damage for un-charged beam here
const int Beam2Damage = 4; //Damage for charged beam here
const int BeamChargeMax = 40; //Time to wait for beam to charge up here
const int BeamDelayMax = 5; //Delay in which Samus cannot shoot (we don't want the screen full of hundreds of beams (I don't think))
//Global utility integers
bool shootbeam;
int beamdelay;
global script slot_2{
void run(){
//power beam utility variables
int beamd;
int beamx;
int beamy;
lweapon beam1;
lweapon beam2;
int charging;
while(true){
//Power-beam script
if(shootbeam){
beamd = Link->Dir;
beam1 = Screen->CreateLWeapon(8);
beam1->OriginalTile = Beam1Tile;
beam1->Tile = Beam1Tile;
beam1->CSet = BeamCset;
beam1->NumFrames = Beam1Frames;
beam1->ASpeed = Beam1Speed;
beam1->Damage = Beam1Damage;
beam1->Step = BeamSpeed;
beamx = 0; beamy = 0;
if(beamd>1) beamx = (((beamd-2)*2)-1)*DistFromSprite;
if(beamd<2) beamy = ((beamd*2)-1)*DistFromSprite;
beam1->X = Link->X+beamx;
beam1->Y = Link->Y+beamy;
beam1->Z = Link->Z;
beam1->Dir = beamd;
Game->PlaySound(BeamSFX);
Link->Action = LA_ATTACKING;
shootbeam = false;
beamdelay = BeamDelayMax;
charging++;
beamd = Link->Dir;
Waitframe();
while((Link->InputA || Link->InputB) && charging < BeamChargeMax){
charging++;
Link->InputA = false;
Link->InputB = false;
if(NoTurn > 0){
Waitdraw();
Link->Dir = beamd;
}
Waitframe();
}
if(charging >= BeamChargeMax) Game->PlaySound(BeamChargeSFX);
while((Link->InputA || Link->InputB) && charging >= BeamChargeMax){
Link->InputA = false;
Link->InputB = false;
if(NoTurn > 0){
Waitdraw();
Link->Dir = beamd;
}
Waitframe();
}
if(charging >= BeamChargeMax){
beamd = Link->Dir;
beam2 = Screen->CreateLWeapon(8);
beam2->OriginalTile = Beam2Tile;
beam2->Tile = Beam2Tile;
beam2->CSet = BeamCset;
beam2->NumFrames = Beam2Frames;
beam2->ASpeed = Beam2Speed;
beam2->Damage = Beam2Damage;
beam2->Step = BeamSpeed;
beamx = 0; beamy = 0;
if(beamd>1) beamx = (((beamd-2)*2)-1)*DistFromSprite;
if(beamd<2) beamy = ((beamd*2)-1)*DistFromSprite;
beam2->X = Link->X+beamx;
beam2->Y = Link->Y+beamy;
beam2->Z = Link->Z;
beam2->Dir = beamd;
Game->PlaySound(BeamSFX);
Link->Action = LA_ATTACKING;
}
charging = 0;
}
if(beamdelay > 0) beamdelay--;
//Power-beam ends here
//Other scripts go here...
Waitframe();
}
}
}
//Activation script for the beam
item script Power_Beam{
void run(){
if(beamdelay == 0) shootbeam = true;
}
}
Replace your old script with this one, and it should all work fine and dandy =)
The set up is a bit different though, it no longer uses a weapon sprite (I couldn't get that to work), so you have to input a bit more information at the top.
This should be pretty much self-explanitory.
Currently it's set up for a projectile that looks the same regardless of direction (so a circle or something), and wouldn't work with a line or similar.
This is intentional, and if you want it changed to work with a projectile that does change depending on which direction it's facing, let me know and I'll fix it up.
I've also changed it so that you can decide how far away from Samus the projectile is fired from, which is now an input at the beginning.
Do with that as you wish, 8 seemed good to me.
The last thing is to do with the 'can only move in one direction whilst charging'.
This does work how I set it up before, it's just that you have to use Diagonal Movement.
Now, I understand that you might not want to for one reason or another, so I've included a little input at the beginning.
If you do decide to change to diagonal movement, just leave the input as it is.
If you want to keep it on the old-style movement, change that input to 0, and Samus will be able to turn whilst charging.
Sorry, it just doesn't seem to want to work with 4-way movement.
#22
Posted 19 August 2008 - 09:25 PM
Would it be possible to add two more features? Just to add a sense of completeness.
2: Make it so there is a sound effect while charging.
EDIT: Actually, scrap number 1.
#23
Posted 20 August 2008 - 04:51 AM
If you only used the blue and red ring in the quest, I could use the gold ring to make Samus flash.
And could you be a bit more specific about the sound effect?
I've put that one in so that it plays a sound effect when the beam first becomes charged, did you want another one too?
#24
Posted 20 August 2008 - 12:10 PM
#25
Posted 20 August 2008 - 01:12 PM
So something that loops?
Or just one sound effect that lasts for that length of time?
#26
Posted 20 August 2008 - 02:44 PM
#27
Posted 20 August 2008 - 06:07 PM
There's no way of stopping a sound effect once it's started playing, so even though Samus' beam isn't being charged to full, it'd sound like it was.
If you get me?
#28
Posted 20 August 2008 - 06:48 PM
#29
Posted 20 August 2008 - 10:18 PM
#30
Posted 21 August 2008 - 04:38 AM
Dyuknow how long your sound effect is in frames?
That's quite important.
One frame is 1/60th of a second.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users