[Bullet Heaven Game] How can I make a weapon attack back and forth?

Hi! i’m Newbie here , and i just start little project like Bullet Heaven Game like Vampire Survivors and Brotao , Cuz i love them anyway i just want to make some weapon like this but i can’t i have tried for like 6 hours but still doesn’t work
what i want is : 1. if it can detect enemeies in range it will attack no matter what range is like , rang for shield attack is 500 but enemy stand in 300 it still attack till 500
2.after attacked it wiil get back at the player like anyweapon in Brotato (i’ve got some screenshot from Youtube)
i really need help.

Make variable for your weapon call it WState

Condition
Variable WState is 0
Enemy distance to player is below HERE you put your distance
Pick enemy nearest to player

Action
Change weapon variable WState set to 1
Add to weapon PRMANENT force toward object Enemy

Another event

Condition
Weapon is in collision with enemy
Weapon variable WState = 1

Action
Here apply damage however you want
Stop object Weapon (remove all forces)
Change weapon variable WState set to 2
Add to weapon PERMANENT force toward object Player

And last event
Condition
Weapon variable WState is 2
Player is in collision with weapon

Action
Stop object Weapon (remove all forces)
Change weapon variable set to 0

When weapon variable WState is 0 this is how you check to position your weapon at player however you are positioning it

So you want the weapon to fire out for the whole range distance, and then have it return? If this is the case then check out the Boomerang extension:

This extension offsets angle of object on return
And i found many users do not want that

I do not remember was it on center or origin point
But i remember you can just go to extension and remove/disable action that does that

Still not a pleasant surprise

Oh! thx now it’s work. not the way i hope but it’s work , that’s okay thx guys

1 Like

Yeah, you want it to go the full 500 and then head back, right? Then maybe try this: