need help with bullets

Game Editor comments and discussion.

need help with bullets

Postby strap111 » Mon Jul 27, 2009 8:19 pm

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
strap111
 
Posts: 6
Joined: Wed Jul 22, 2009 10:37 pm
Score: 1 Give a positive score

Re: need help with bullets

Postby Hblade » Mon Jul 27, 2009 8:35 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: need help with bullets

Postby strap111 » Mon Jul 27, 2009 8:59 pm

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
strap111
 
Posts: 6
Joined: Wed Jul 22, 2009 10:37 pm
Score: 1 Give a positive score

Re: need help with bullets

Postby DST » Tue Jul 28, 2009 7:18 am

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.

:)
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: need help with bullets

Postby strap111 » Tue Jul 28, 2009 12:12 pm

ill get workin on it thanks :mrgreen:
strap111
 
Posts: 6
Joined: Wed Jul 22, 2009 10:37 pm
Score: 1 Give a positive score

Re: need help with bullets

Postby strap111 » Fri Jul 31, 2009 7:47 pm

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
strap111
 
Posts: 6
Joined: Wed Jul 22, 2009 10:37 pm
Score: 1 Give a positive score

Re: need help with bullets

Postby DST » Fri Jul 31, 2009 8:06 pm

Yeah add the dir= to new keydown events.
Then you'd use the angle for bullet>createactor>
Code: Select all
angle=creator.dir*90;
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest