Custom point not accurate when using stay on screen

How do i fix this? I made a topdown movement for a sprite and used for horizontal shmup. i also use stay on screen behaviour on the main sprite. I create a custom point as a shooting point but this point moved everytime i collide against the screen edge(stay on screen).
How do i fix this?
Attached is a gif, the red square move upon collide. Help me!

GDevelop_gAlJQBnIXm

Excuse me, may I ask which events you use?

So far no event yet.. I just put the topdown behaviour and stay on screen behaviour. Thanks for asking

What’s happening is you are placing the red square where the space ship is, and it is after this action, once all events have been run, that the “Stay on screen” extension adjusts the sprite to keep it on screen.

In a nutshell, I don’t think this is much you can do, other than write your own set of events to keep the sprite on screen and then move the red square.


FWIW, the events you can use yourself (based on the “Stay on screen” extension) are:

Note - my WhiteBlock is the equivalent of your red square.

I have a method that I think will work. Create a point on the main sprite—by “main sprite,” I mean the spaceship. Then, create an event that continuously updates the red square’s position to match the position of that point on the main sprite.

Sorry, what I meant was for you to create a point within the spaceship object and use an action to align the red square’s position with that point. Have you done that?

In my opinion, it is better not to have an extension for the red square, but using one for the spaceship is fine.

Thanks bro, i will try this. This event should be use without the extension right?

Yes, use those events instead of the extension.

Thanks for the suggestion bro, but i already have that event. Actually that event only to debug the problem since my bullet spawn on the wrong place

Oh, sorry—I thought you didn’t have any events.

If you want the red square to stay in position, then look at using the Sticker extension. Once added to your game, add the sticker behaviour to the red square, and then in the events stick it to the space ship sprite once and the extension does the rest of the work.

Here’s an example of how it works.

Thanks for the suggestion bro!

you can also just not use a sprite that indicate the shooting point. Instead you can put a custom point on your main sprite. use pointX() and pointY() to fetch its position.

OP would have been using a custom point. They’re placing the sprite on the custom point to show that firing from that point was moving around.