Transforming

0 favourites
  • 4 posts
From the Asset Store
Merge Planet
$6.30 USD
30% off
Welcome to Merge Planet, an exciting puzzle adventure game where you can test your strategy and logic skills! Collect p
  • How do I transform a sprite while playing? For example when Mario gets a fire flower he turns into Fire Mario and can now shoot fireballs.

  • Short version:

    You can use sprite's animations and variable.

    Edit your sprite, add another animation (with some Fire Mario frames).

    In event sheet, when transform is on, set your sprite's animation to the good one. Then set a sprite's variable to 1 if needed to detect the transform.

    If press fire button and this variable is 1 ==> launch fireball !

  • Thanks. Now what if I wanted the transformation to last a limited amount of time?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not sure it's the best method but you can do a thing like this:

    Add a global variable (called "timer" for example).

    Add en event: Every tick and transform variable = 1, add value dt (not set!) to "timer". Why ? Because sum of dt = 1 every second (deltatime tuto).

    So if you want to stop transformation after X seconds, check every tick if "timer" >= X. If true, set transform variable to 0.

    or maybe this, better and simpler but dunno if it works:

    when transform variable is set to 1, add two other actions : wait X seconds, and set transform to 0.

    edit:

    it works ! find here a very simple example:

    .capx

    T to transform, Space bar to fire.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)