Setting sub-sprite position on Parent Sprite with Sine Beh

This forum is currently in read-only mode.
  • To the point:

    I have spaceship sprite (which moves and when not moving usies Sine Beh) which has couple of moving sub-sprites (panels, turrets, launchers etc) at i want them to "stick" to the image points of their destiny and mostly it works. But this is my problem - i want the sub-sprite to "float" with the parent sprite but also move having in mind the sine changing position. think about a hatch doors on side of spaceship that opens by sliding in a direction(being behind the ships) and i dont know how to set it. i want the "hatch" doors to slowly open and close when i order so but with sine beh in mind.

    Ofcourse i can do the same by adding frames to the spirte but this seems more VRAM eating and less elegant (and mostly - needless)

  • clamp(lerp(door.x,ship.imagepointx("point"),1-0.5^timedelta),ship.imagepointx("point")-5,ship.imagepointx("point")+5)[/code:6cwfrdso]
  • Okeey... you want me to print it and stick on my fridge doors or something?

    please make your answear a bit more explanatory, i am not a CC pro.

  • That would be the x of your door sprite, with a leeway of 5 pixels either way. You may need to adjust to how ever wide you want it to move. Then just set its y to ship.imagepointy("point").

    I'm not too sure how well that will work with sine, so you may need to make a switch using pv's.

  • i see. should i use this with "set positiom x/y" ?

    what type of command to use?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Always set x/y would do it.

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