Page 1 of 1

can only shoot one way!

PostPosted: Tue Jun 09, 2009 7:38 am
by savvy
how do you get it to shoot the way that you are facing, i have tried, but i can not work it out.

Re: can only shoot one way!

PostPosted: Tue Jun 09, 2009 8:54 am
by jimmynewguy
depends on what kind of game platformer? space shooter?

Re: can only shoot one way!

PostPosted: Tue Jun 09, 2009 11:36 am
by Bee-Ant
First, make a variable called "direct"
Put this code on Keydown to left
Code: Select all
direct=0;

Put this code on Keydown to right
Code: Select all
direct=1;

Put this code on Keydown to shoot
Code: Select all
if(direct==0)
{
    //put your code to shoot to left here
}
if(direct==1)
{
    //put your code to shoot to right here
}

Re: can only shoot one way!

PostPosted: Tue Jun 09, 2009 11:39 am
by savvy
Ok, thanks. although, i will repost if i have any problems!

Re: can only shoot one way!

PostPosted: Tue Jun 09, 2009 9:07 pm
by DST
Remember how ge starts with 0 degrees to the right?

How about you reverse those numbers - 0 for right and 1 for left.

bullet>createActor>

Code: Select all
angle=direct*180;


:P

Re: can only shoot one way!

PostPosted: Thu Jun 11, 2009 4:30 am
by Bee-Ant
That won't work unless you put...
Code: Select all
angle=direct*180;
directional_velocity=10;

:P

Re: can only shoot one way!

PostPosted: Mon Dec 13, 2010 7:46 pm
by Orlando911
how can I make enemy shoot the player, in his direction,

for example, if the player move anywhere, the enemy shoot him,

so I tried to make enemy shoot in only one direction, make shoot velocity ( xvelocity = -4 ; )

but when the player move, I don know how make the shoot go to his direction ,

Re: can only shoot one way!

PostPosted: Mon Dec 13, 2010 8:18 pm
by Orlando911
thank you,

I got it from the game (moondefender),