How to Keep an Actor Onscreen After Changing Image

HamminationHammination Member, PRO Posts: 4

My actor collides with a wall and change image, but the new image only remains for one frame. How do I keep the new image on the screen for a few seconds? Just long enough to see?

Comments

  • ArmellineArmelline Member, PRO Posts: 5,354
    edited April 2023

    If the image is disappearing, then you're presumably either destroying the actor, moving it off screen, or replacing the image with another one immediately after.

    I'm assuming given the context that it's the first one or third one.

    If you're having the actor hit the wall, and using the collision with the wall to trigger the image change (e.g. when actor collides with wall, image 1, otherwise image 2), you can put a "constrain attribute self.image to image 1" into a For timer, and set Run to completion to true.

    If you have the actor hit the wall and get destroyed, you can either delay the destruction of the actor until the image has been displayed for the appropriate amount of time, or spawn a new actor that just shows the image and then gets destroyed after the appropriate amount of time.

    Hard to say what you'll need to do without more info, though.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,159

    If the image is moving off screen, but you want it to stay still after the change, also remember change the self.Motion.Linear Velocity.X and Y to 0. That will "stop" the actor.

Sign In or Register to comment.