Page 1 of 1

need help with bullets

PostPosted: Mon Jul 27, 2009 8:19 pm
by strap111
i have the bullets working and killing people but i was wondering how to get the bullets to shoot the way i am facing
ex. left-bullet goes left same with right
but all i can do is go one direction per game plz help :D

Re: need help with bullets

PostPosted: Mon Jul 27, 2009 8:35 pm
by Hblade
Put 2 variables, called standingright and standingleft, then when key right is pressed, standing right is 1 anmd standing left is 0, when left is pressed, standing left is 1, standing right is 0 No wait, have thos on Key up and key down

Re: need help with bullets

PostPosted: Mon Jul 27, 2009 8:59 pm
by strap111
Hblade wrote:Put 2 variables, called standingright and standingleft, then when key right is pressed, standing right is 1 anmd standing left is 0, when left is pressed, standing left is 1, standing right is 0 No wait, have thos on Key up and key down

so like i go to key down > then script editor and make those variables. and do the same for key up

Re: need help with bullets

PostPosted: Tue Jul 28, 2009 7:18 am
by DST
You can do it with just one variable.

Add the keydowns for it in counterclockwise order, starting at right.

so keydown right>
dir=0;

keydown up>
dir=1;

keydown left>
dir=2;

keydown down>
dir=3;

you don't need a keyup event. Usually you want your character or gun to stay facing the last direction pushed.

Now you can use dir for angle as well, where angle=dir*90, since right is 0 and up is 90, etc. in the GE coordinate plane.

:)

Re: need help with bullets

PostPosted: Tue Jul 28, 2009 12:12 pm
by strap111
ill get workin on it thanks :mrgreen:

Re: need help with bullets

PostPosted: Fri Jul 31, 2009 7:47 pm
by strap111
DST wrote:You can do it with just one variable.

Add the keydowns for it in counterclockwise order, starting at right.

so keydown right>
dir=0;

keydown up>
dir=1;

keydown left>
dir=2;

keydown down>
dir=3;

you don't need a keyup event. Usually you want your character or gun to stay facing the last direction pushed.

Now you can use dir for angle as well, where angle=dir*90, since right is 0 and up is 90, etc. in the GE coordinate plane.

:)


yeaa.. i dont understand like do i make a variable called dir then make new key down for right up left and down ? then would it work and were do i put the angle part im so confuzed lol

Re: need help with bullets

PostPosted: Fri Jul 31, 2009 8:06 pm
by DST
Yeah add the dir= to new keydown events.
Then you'd use the angle for bullet>createactor>
Code: Select all
angle=creator.dir*90;