Create objects on a sine wave.

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi, Im new to construct(LOVING IT) And have started to understand it really well!! One quick question if you wouldn't mind helping a noob out..

    Could someone tell me how to make a object follow a sine wave and spawn a object from its position every x seconds..

    I know how to spawn every x seconds,

    And I know a very rough way of making the wave(Using MoveTo plugin) But i want a really nice smooth wave, Which can be adjusted at runtime.

    Thanks for your help!

  • Could the behavior Sine of help here ?

    Else, Pode is supposed to release a spline movement behavior soon. Be sure to check the plugins section back from time to time.

    And finaly you can always control your object through events, setting its movement as you like each tick. (Maths involved). How events work.

    Hope it helps.

  • Kyatric,

    I tried to use the sine behavior, But I dont really understand it..

    and as for doing through events, What do you suggest somthing like:

    global var targetY1

    global var targetY2

    System: Every tick

       Object:Set y Position - lerp(self.y, targetY1,0.8)

    Something like that? But then how about once it hits its target position, How do you set it to target the next(targetY2) ?? and what about smoothness. Any ideas?

  • Sine behaviour is the way to go. Set movement to vertical or horizontal and adjust the other properties. It's pretty simple, have you looked at the examples?

  • If you like to take look at my "sine solution", you may look in my CAPX..

    Here is the LINK

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • , Thanks for the capx, But it all seemed a little to complex to me.

    , Yeah eventually i understood the sine behavior, I was just being dumb to be honest :)

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