How do I flip the shooting character?

Project link:

What is happening in the project, and what do you want to happen instead?
I want to flip the flash effect but it doesn’t and the gun, idk how
Screenshots of code:


Instead of moving each object individually, set the weapon’s position to the character’s position with some offsets (when referring another object for positioning, put it inside a when game is playing to ensure it updates once you let go off the move buttons). Use positive offsets if the character is not flipped, and negative offsets if they are flipped.

If you would like to still use broadcast message to move the bear, that’s also ok for now (though it is something you might want to change later).

In my post, I will assume that you are still using broadcast move left or right to move the bear.

I would first recommend adding a self variable called “flipped” to Bear. So, when Bear hears message “MoveLeft”, it sets flipped to 1 before setting position.

This is because you will need to check if bear is flipped from another object

For the gun, you should have two separate possibilities for each clone:

  1. When (Bear)-flipped = 0
    This is when bear is facing right. In this case, you keep the offsets you had before.

  2. When (Bear)-flipped = 1
    This is when bear is facing right. In that case, just offset each clone by the same amount in the opposite direction. Instead of +180px from center, just do minus that amount.

For example, you can change your code to match the second screenshot, then delete the gun’s message matches rules[1]

Also notice how I also put the set position in the repeat forever. This means that you don’t need to update it by a fixed offset every time when you receive the moveleft or moveright message.

  1. ↩︎

1 Like

How do i get the bear’s position?

Awesome_E shows you how.

Alright. I removed the gun inside bear and i offsetted the seperated gun with bear, also i cant find the bear in x and y its the 0 clone index being targeted, still did it anyways

Yeah, you can only reference the original object of a different object.

Easy fix would be to set the bear’s clone index to the original object (0).

Another fix would be to use game variables. All you would need to do is set the variable when you move the bear (preferably after you move it).

Ok i scrapped the game it’s too hard


All games will start out small, but as you code more and more, eventually, the game will turn out incredible. Just give it time and some dedication. Take my game, WWC, for example. It started out as a platformer template that I made (credit to Spy Guy 96), and now there’s so much more.

Would you like @Awesome_E to clive? (Close and Archive)


I worked on the game for a bit, and I’m happy to say it’s actually working. Thanks for motivating me.