Player shooting (bullet start point problem)

Game Editor comments and discussion.

Player shooting (bullet start point problem)

Postby d-soldier » Wed Apr 25, 2007 8:02 am

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!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Game A Gogo » Wed Apr 25, 2007 11:10 pm

can you explain me what you mean about the position.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

okay

Postby d-soldier » Wed Apr 25, 2007 11:28 pm

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?
Attachments
pr_help4.jpg
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Game A Gogo » Thu Apr 26, 2007 12:00 am

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

---

Postby d-soldier » Thu Apr 26, 2007 12:05 am

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)...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Game A Gogo » Thu Apr 26, 2007 12:21 am

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.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

nope

Postby d-soldier » Thu Apr 26, 2007 12:23 am

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...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Game A Gogo » Thu Apr 26, 2007 12:33 am

then it would look like:
Code: Select all
if(animpos==0)createactor("......");
else if(animpos==1)createactor(".......");
else if(animpos==2)createactor(".......");
//etc...
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby d-soldier » Thu Apr 26, 2007 12:44 am

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!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Game A Gogo » Thu Apr 26, 2007 12:48 am

do what i just told you to do whit the variable finction after yo have typed the "if / else if" things!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 12:48 am

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron