How do I create one object on basis of another

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I have a flashlight underneath it I have placed a sprite to simulate the light beam (triangle sprite with reduced opacity of yellow color).

    The problem is, if I copy my flashlight without cloning/creating new object, how can I make it have this light beam also?

    For example, If i'll add drag and drop on my flashlight, whenever I move my flashlight its light cone must move with it.

    I hope this will illustrate it

    At the moment the only option I see is using frames, one without the lightbeam and one with, and switch between them.

  • everytick = lightbeam.setangle-to:flashlight.angle that should solve it

    or you can use the pin behavior on light and pin it position&angle and will automatically follow the flashalight angle and position.

    here is a capx example v2 using pin

    i updated the toggle of the lightbeam now when you press the flashlight from button to the tail area it toggles the opacity of the lightbeam sprite.

  • And if you want to copy the flashlight and have the new one also have its own beam, use containers <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> https://www.scirra.com/manual/150/containers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • everytick = lightbeam.setangle-to:flashlight.angle that should solve it

    or you can use the pin behavior on light and pin it position&angle and will automatically follow the flashalight angle and position.

    here is a capx example v2 using pin

    i updated the toggle of the lightbeam now when you press the flashlight from button to the tail area it toggles the opacity of the lightbeam sprite.

    Thanks but I wanted to achieve something a bit different. As for now you have a flashlight and light beam, what I wanted is to use the same lightbeam on other copies of flashlight, like for example, If i copy the flashlight, set it to rotate by a bit different curve but use the same lightbeam on it. Such as, it moves differently, but light the same.

    And if you want to copy the flashlight and have the new one also have its own beam, use containers <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> https://www.scirra.com/manual/150/containers

    According to the manual this approach creates same object, but I can't manipulate each one of the created objects separately. I would like to animate the flashlight, or change its position independently of all other flashlights.

  • Using gamecorpstudio's example, click on the Flashlight, create a container and add the Lightbeam. Make two more copies of the Flashlight. Done!

  • Using gamecorpstudio's example, click on the Flashlight, create a container and add the Lightbeam. Make two more copies of the Flashlight. Done!

    Thanks, that's what I've been looking for.

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