Help with Spawn bullet?

I want to spawn bullet on the enemy that will move towards the player.

the triangles are enemy.
I want the bullet to spawn at position( X of triangle +40, Y of triangle +40) (For each and every triangle which is near the player). I am saying again: (For each and every triangle which is near the player) Screenshot_11
The yellow is supposed to be bullet spawn positions. I have created 2 events. Which one should have been correct?
BTW Both of these Events Dont work. I dont know what is wrong.

This is supposed to be the bullet spawn position.

This is a object var because spawn position of bullet is different for every enemy.
I dont know which of these is supposed to be correct.
None of them works.
Please help

The “for each” event should work, but there’s few things.
-Did you reset the timer for bullet at beginning of scene?
-Is sense variable of triangle 1?
-Have you tried Instant force instead? Permanent force goes really fast.
-You can create object at image point instead. Instead of triangle.X and triangle.Y try triangle.PointX(“Center”), and pointY also - this is built in image point.

If you’re not sure how to type a function (or to find more), use the sigma symbol beside number value actions like in screenshot. For “X position of a point” it’ll just ask for the relevant object name.

Otherwise, you can try simplify your code first, first create the bullet and see if it even appears on the screen, then move on to rotating it, moving it, etc…

In agreement with Cat above.

Try simplifying your events. Remove all conditions, and see if the bullets spawn/move correctly (although it will be constant). If that works, add your sense variable, and MANUALLY set it to 1. If that works, then add your timer. Etc.

1 Like

Yes it moves correctly. Yes it spawns . But if one shoots then other doesnt.
Only in rare cases both shot.

I am creating 10 enemy objects but are duplicate.
Like Enemy1, Enemy2.
I dont know how to do it other way so i am doing manually.