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!
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:
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.
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.
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.