praaab wrote:but how do i make the actor able to shoot from both sides
First, you need to declare a variable. Go to some event with script editor and at the script editor click variables, then add, then name it dir (shortening for direction), leave those integer and global as they are and click add. Then close the script editor.
Now add this code to your player actors key down event (right) - script editor:
- Code: Select all
dir = 1;
And this for key left:
- Code: Select all
dir = 0;
Now, 1 is for right and 0 is for left.
Next, go to the key down event for shooting - script editor and add this code:
- Code: Select all
CreateActor(...); //You can add the function to script by clicking "variables/functions". Find CreateActor(); from there and create your bullet actor.
if (dir == 1)
{
bullet.xvelocity = 10;
}
else if (dir == 0)
{
bullet.xvelocity = - 10;
}
Remember to change the "bullet" before those xvelocities to the name of your bullet actor.
There you go! Did this help?

- lcl -