Boss attack help!

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm trying to make a boss fight right now and one of his attacks is not working the way I want.

    He's a big guy with two floating fists and I want his fists to move near the ceiling and then slam on the ceiling a few times.

    I have tried using tweens, sines, set position with lerp, and combinations of each of them.

    The problem is that if I lerp the position to near the ceiling and then start a sine wave to have it move up and down, the sine wave doesn't work properly for the first few seconds.

    So I'm wondering if there's a better way of doing multiple movements one after another without delays.

  • You want to set up what is called a state machine. Use an instance variable to keep track of the state of the boss.

    In this case, you have two states: moving hands to ceiling (1), and slam on ceiling (2).

    So on trigger, set boss.state to 1

    If boss.state is 1, trigger once - hands moveto/tween to ceiling

    On move completed, set state to 2

    If boss.state is 2, enable sine, start timer

    On timer completed, set boss.state to 0, disable sine.

    You can add states and behaviors however you want afterwards as well, the instance variable keeps track of what the boss should be doing at any given time.

  • I am using the Finite State Machine add-on. But I never thought of using multiple states for the one attack. I'll try this and let you know how it goes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alternatively, you can just use the on arrived trigger in the moveto behavior to turn on the sine movement. I prefer states though, as they are usually easier to organize and clearly defined.

  • Alright, I got it working. Thanks for the tips!

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