Top down shooter fireing problem

so i am so i have made the character and the character rotats but when i fire it will fire up right, right, down right, down, down, and down left so it wont fire up, up left, and left please help also i am not using the mouse for this game so please don’t sudgest it.

shadowbrine

Can you include screen snips of your firing events? We can’t help if we don’t know what you’ve done.

Here is the picture sorry I did not add it before

Are there any other events further down? So far it looks ok, and I’m just wondering if there’s something else going on.

And to confirm, if you press the “a” key and then one of the firing keys, the bullet isn’t fired?

I will make a video tomarrow I don’t have time now

I fyou can’t watch it I will change it

Hi, as MrMen mentioned, the events in the screenshot look fine, but the problem may be caused by some other event that we can’t see. Please send a screenshot of the rest of the events.

Here is what the rest of the code is

The problem is with the last event:

  • bullet in collision with player → delete bullet

It’s not shooting only on certain angles, probably because as I can tell from the video, the origin point of the bullet is at top-left and not in the center, so when the player is turning to the left, only then it collides with the bullet when fired and the bullet gets deleted immediately.

Can I ask why did you add this event?

1 Like

the game is going to be an online game and i did not want to go and make a bullet and a player for each player in the room

i should have thought that was the problem

i also made the player hitbox smaller and now it works fine got the idea when you said something about the bullet in collision with player so thanks

the hit box was the whole player not the gun and i made it only around the black on the players head and it work

shadowbrine

The bullet should not be able to interact with it’s source player, even if it’s working now with a smaller collision box, it could cause some problems later if let’s say the player is moving and a collision is detected.

You don’t need to create different bullets and players. You can use unique IDs for each player and set the fired bullets to have the same ID as the source player. Then only detect collisions when the IDs don’t match. Also the unique IDs may come in handy for other purposes in a multiplayer game.

It’s fairly simple, install the extension “Unique Identifiers” and add this event (this is an example, adapt it to your events):

OK sweet I will add it when I got time does the extension need to be on the player or bullet

No, just added to the project.

how do you get the repeat for each instance of an object like player or bullet

Click on the (+) button on the top right to add an event > For each object
or
Right-click > Add event > For each object

1 Like

thanks a ton i changed the hit box back to normal and i can fire from all directions now thanks again

1 Like

@insein i tryed putting another player in and it won’t delete the objectike it is supposed to here is my code

You need to specify which object you want the for each event to repeat for. I think in your case it’s “bullet”.

Also to make sure the correct player is picked, flip the conditions (bullet ↔ player):

  • player is in collision with bullet
  • text ID of player != bullet.VariableString(ID)

OK thanks I did not even see that