How do I create object and control opacity with touch?

0 favourites
  • 13 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hello guys,

    I want to use touch to create each time an object and depend the distance to control the opacity of last 3 (whatever) creations.

    Can you help me with this?

    I don't know if can help but here is the demo project:

    dropbox.com/s/cmcv81v9ceumxmv/Boxes.c3p

    Details:

    1. Touch start: create first object

    2. So, moving around, depend X,Y distance, create +X objects depend the distance of current X,Y and first X,Y.

    3. But, moving back will destroy the objects are out of distance.

    4. Touch end: destroy all

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Opacity from first created to last, last created being 100% ?

    Or for the first 4 created only.

  • Thank you, but this not working as my image example above.

    Look, to understand. Let's say we create 10 boxes. So, we have:

    First Creation: 1 => Opacity: 100

    ______Creation: 2 => Opacity: 100

    ______Creation: 3 => Opacity: 100

    ______Creation: 4 => Opacity: 100

    ______Creation: 5 => Opacity: 100

    ______Creation: 6 => Opacity: 100

    ______Creation: 7 => Opacity: 100

    ______Creation: 8 => Opacity: 70

    ______Creation: 9 => Opacity: 40

    Last Creation: 10 => Opacity: 10

    Something like this. Of course, what extra need is to have creations depend distance. But again, thanks for your help! :)

  • This will give you 60,40,20 for the last 3 created.

    So 15 objects would be 80,60,40,20

    You can mess around with the math to adjust.

  • Cool, thanks for this help!

    But unfortunately the best will be to controlled via distance + new creation each time.

    Because in this example we have 10, or whatever boxes. And opacity will always be set default no matter mouse/touch is (in this example last 3 creations).

    If for some reason can made a new creation each time we have touch X/Y would be perfect. :)

    Like the example below:

    Please note: Touch X in this image, it's just an example. The control remain as original, use X,Y and angle.

  • If I understood correctly ?, this will adapt to any object count, and just effect the last 3 boxes.

  • I would just use a Tiled Background with a gradient mask using blends.

    If we had distort maps I would just do it that way...

  • sizcoz

    This, effect the current creations. So in your example, control of course the last 4 boxes opacity but still remain 10 creations in the screen.

    Also, this lines not work with touch distance.

    Anyway, thanks again for your help. :)

    newt

    Sorry but no need something like this. Thank you!

  • Sorry last pic I forgot to put an event in.

    Revised below.

    I still don't understand what you exactly want?

  • Yes i already fix it myself. But still no make sense to me, sorry.

    As i said, it create already the boxes and just gives me the opacity to latest boxes. What i try basically is to control the opacity by distance.

    Means, each last 3 for example to keep the opacity like your example, but need to me change all this.

    Example:

    We have 10 boxes: Last 3 opacity like your example.

    We back the touch a bit, so we have now 5 boxes.. Same as above, last 3 opacity.

    All it's about touch distance between first creation and touch.x touch.y

    Maybe it's a bit complex, but basically this is the main reason, this is what looking.

    Thanks again for your time and help!

  • Any help, someone?

    I try to find any similar project here without luck.

    Thanks!

  • Something like this?

    dropbox.com/s/n1nt5yuih8c3exe/Boxes-example.c3p

    For each created box, check if the distance is farther from the origin than the touch distance. If it is, set opacity to an inverse function with x, where x is the distance from touch (as distance increases, opacity decreases, normalized between 0-100).

  • oosyrag

    Great example, many thanks! :)

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