Shooting in different directions

Non-platform specific questions.

Shooting in different directions

Postby metaknight22 » Tue Jan 27, 2009 7:40 am

How can I make my actor shoot in 2 different directions. I've looked at other posts but they don't make sense to me. Can anyone explain in simpler terms???
Projects
Kirby Starship Game

I'm a newbie so I haven't done much.
User avatar
metaknight22
 
Posts: 25
Joined: Fri Jan 23, 2009 7:34 am
Score: 1 Give a positive score

Re: Shooting in different directions

Postby skydereign » Wed Jan 28, 2009 12:37 am

There are many ways to do this. One way: You will need to create a direction variable. When you press RIGHT, it sets the variable to 1, when you press LEFT, it makes it -1. Upon the creation of the projectile use this code;
Code: Select all
xvelocity=5*dir; // 5 is the speed you want, dir is the direction variable
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron