How to change an object image?

  • #1, z chris-poweringSunday, 19. May, 10:04 hodinky 4 months ago
    Hi there!

    I'm a complete noob in building an adventure game in VS 5. But I tried to make an object animation of a drawer to pull out and stay open. I added the action to pull the drawer, and start the animation of the drawer moving with it. But I cannot change the image of the drawer afterwards like:

    Show image of drawer loaded with scene => show animation of moving drawer => show end image of pulled out drawer

    I do not want to make another pulled-out-object to hide on scene start and show, when drawer is pulled. I think, that would be way too complicated to set the respective init states and hide / show logics.

    Any ideas how to solve this?

    Bažant

    2 Posts


  • #2, z esmeraldaSunday, 19. May, 10:29 hodinky 4 months ago
    Hi!

    one thing up front: the forum isn't very active any more. All conversation moved to the discord channel of Visionaire Studio. (there is a link at the bottom of the page, feel free to join!)

    I would actually recommend using a second object. It is not complicated, and easier than fiddling with animations or even forcing animation frames.

    just add a conditon, name it so you remember what it does, like "drawer_open?" and set it to false.
    Link the object of the closed drawer in the object properties to this condition. And because the object should be active when the condition is false, enable the little checkbox called "negate condition".
    The object with the opened drawer you link to the same condition. This one should be active when the conditon is true, so don't tick the box.
    This will switch between the two objects depending whether the condition is true or false.

    Now you only need to change the condition to switch.
    You have an animation you play for opening the drawer. You can add actions in the frames of the animations. Click on the last frame of the animation, then click on the pencil icon. A window pops up where you see the image of the animation frame and below is a field called "Action". Click on the little yellow arrow, that will open up a new window where you can add action parts. Add a change condition action part and change the "drawer_open?" to true.

    This action part will be executed when the last frame of the animation is played -> the object drawer open will be active.

    Zabiják klíčů

    525 Posts

  • #3, z chris-poweringSunday, 19. May, 11:26 hodinky 4 months ago
    Okay, the usage of a 2nd object was simpler than I imagined. Thanks to your good and fast explanation. smile

    Bažant

    2 Posts

Napsat příspěvek