Shooting

http://flowlab.io/game/view/20765
In my game I can’t figure out how to make the bullets only when the player obtains shotgun or how to make them move the direction pointing or at all.

Sure I can help you with that.
Open behaviors on your player object.
Drag down a press button trigger, set it for say “spacebar”
Now create a new object.
Checkmark “moveable” and then open behaviors.
Add “Always” trigger, connect that to a number.
Add any number you want but I recommend above 20 or the bullet falls.
I forget how to lock Y so it doesn’t, ask grazer later.
Now connect that number to a “velocity” for forward.

Go back to your player
Connect an “Emitter” to your button trigger “spacebar”
Set the emit to your bullet object
Set the emit to match direction, set your force to 5 so it doesn’t appear behind you
Now set the age before it disappears.

I would suggest you add a “collision” “any” to “destroyer” for your bullet object so its not sliding up and down the wall until it disappears.

Hope I helped :slight_smile:

Thanks! Helps a lot. But I have one question now. how do you make it shoot only when he picks up the weapon and how do you make it change direction when you change?

As for having a gun or not you will want a toggle switch.
I noticed you have a lot to fix.
I said The weapon click and Set the emit to MATCH DIRECTION, if you face left it should shoot left. For the bullet you have it on (x), connect that number to a “velocity” for FORWARD.
That will fix your current problem.
The other suggestion I have is have the emit time go to maybe 24

For your gun you have it an animation, what you should do instead is make a shotgun object and add an attacher to your player for the shotgun. You carry it instead of an animation. When there’s the attacher on, it should have a toggle switch like this

Spacebar goes to (in)
Attacher both (out) goes to (swap)

toggle (out 1) goes to nothing
(out 2) goes to the emit

Make sure you read closely what I type if you want it to work :slight_smile:

loads of help, thanks!

Thanks dude

Ur a lifesaver

https://flowlab.io/game/view/213052

@Mhx Air can you screenshot the attatcher thing, i am conused. I wanna make it so my character can kill enemies only when his sword animation is going, wanna help?
Failure at Flowlab is a Failure.

My bullets shoot behind me.

You talking about “BattleBlasterz”? They seem to be going the correct direction to me, but it’s kind of hard to tell.

hey

@Mhx Air Thx,now my bullets actually work!

how to shoot in upward direction for games like space invaders

help me

Same as the tutorial I wrote, but change the forward direction of your object to up. You’ll see it in the tab under where you edit the bounce and drag. Once your forward is up, objects should emit up.

I tried but it didn’t work

Capture

no the forward of the object thats launching it

forum.flowlab.io/discussion/2650/how-to-make-an-enemy-shoot-on-player-in-top-down-shooting-games-like-space-invaders?new=1