Page 1 of 1

Player shooting (bullet start point problem)

PostPosted: Wed Apr 25, 2007 8:02 am
by d-soldier
Much like the Abuse2 demo, my player has a 360 degree rotating torso for aiming/shooting... My animation is great, but I need to take the time to script a modified start point for the created bullet(x/y location from the player_torso actor) for each frame of the 360 degree movement, as the rifle is not always extending right from the center of each sprite. How would I go about doing this, anyone? Could someone show me a line of the script for this type action that I can duplicate for each frame and adjust? I appreciate it!

PostPosted: Wed Apr 25, 2007 11:10 pm
by Game A Gogo
can you explain me what you mean about the position.

okay

PostPosted: Wed Apr 25, 2007 11:28 pm
by d-soldier
SEE PIC BELOW:
The red lines represent where the "creat actor" for the bullets should come from (not always the center of the player torso actor). The blue lines are where the bullets are starting (center) which causes them to obviously not come from the player's gun. So I need to script the bullets' create actor action to adjust starting coordinates (x/y based on the player's torso) for each frame of the Player's 360 aiming. Does that make sense?

PostPosted: Thu Apr 26, 2007 12:00 am
by Game A Gogo
k, its because maybe i could of done it in one line of code!
*thinks hard*

If i could have the Player sprites (DO NOT WORRY ABOUT ME STEELING THEM!) and the bullet sprites.

I could cook you somethign, PM me or E-MAIL me (Gogo4pogo4u@aol.com!

---

PostPosted: Thu Apr 26, 2007 12:05 am
by d-soldier
I'm not worried about you stealing my sprites... and I'm not worried about taking the time to script it out for each frame of the animation, I just need to know what the line would be for each.. such as:

if (animpos == 1) create actor bullet, y+2,x-5 player_top, y-whatever...

I have no idea how the line would look (clearly)...

PostPosted: Thu Apr 26, 2007 12:21 am
by Game A Gogo
just click on (Variable/function) then click on create actor make sure that relative to actor position is selected, and in the x,y fields, put the amount needed.

nope

PostPosted: Thu Apr 26, 2007 12:23 am
by d-soldier
But there needs to be an IF, each frame has a different position... so it's going to be 36 (35 really) different IF's for each animpos of the animation...

PostPosted: Thu Apr 26, 2007 12:33 am
by Game A Gogo
then it would look like:
Code: Select all
if(animpos==0)createactor("......");
else if(animpos==1)createactor(".......");
else if(animpos==2)createactor(".......");
//etc...

PostPosted: Thu Apr 26, 2007 12:44 am
by d-soldier
Thanks... but does anyone know what all the crap following the create_actor is (all the numbers and such?) I'll see if I can figure it out when what you just posted. Appreciate the help!

PostPosted: Thu Apr 26, 2007 12:48 am
by Game A Gogo
do what i just told you to do whit the variable finction after yo have typed the "if / else if" things!

PostPosted: Thu Apr 26, 2007 12:48 am
by Sgt. Sparky
accually you could just use somthing like this,
although you would need to change the value of st! :D
make a integer called st,
on create actor of the bullet,
Code: Select all
angle = ANGLE;
directional_velocity = 15;
st = 0;
transp = .99;

on the draw actor event of the bullet,
Code: Select all
if(st == 0 && distance(x, y, theactorthatcreatedit.x, theactorthatcreatedit.y) > whatever)
{
st = 1;
transp = 0;
}

and on the event that it creates the bullet(use this for you badie),
just make it create the bullet!
and use this code as well after you make a variable called ANGLE,
Code: Select all
ANGLE = animpos*10;

or whatever is required.
:D
I hope that helps. :D