Chance to stick?

This forum is currently in read-only mode.
From the Asset Store
5 Types of Touch Buttons containing 90 touch buttons from D-Pads to Touch Joy Sticks and more.
  • I was wondering if anyone could suggest someway I could make it so that when 2 objects touch there's a chance for them to stick and be dragged, dropped and rotated as a single object?

    Thanks in advance!

  • That's a bit vague, how are they going to rotate, and whats the chance for a stick?

    Without knowing much more I'd say take a look at the custom movement behavior.

    There's an action called restrain distance from object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, sorry! Well I'm not 100% sure how rotation will work right now.

    At the moment rotation is set up for the individual incomplete little pieces that are meant to attach and it works via a double click, I'm certainly willing to change this if it doesn't work out, though.

    The chance for stick varies depending on the level, initially it's 50% and on the last level (15) it's 95%.

    I'm going to look into the restrain distance action right now! I hope my specifications helped!

  • I hope my specifications helped!

    It's still rather vague. It's best to give a general description of the actual gameplay you're trying to create and what is going wrong in creating it, like "I'm making a 2D Katamari clone, how do I get it to pick things up? I've tried X, Y, and Z but it doesn't work."

  • Here's an example:

  • Okay, I'll get into further detail! Also, thanks Arima, your tutorial gave me some ideas.

    My idea for a game is a packing puzzle.

    In this puzzle the game generates shapes composed of equilateral right angle triangles to fit into a square box.

    When the box is filled the game advances a level. Advancement in level means that the box to fill is 1 unit larger in the x and y direction. I used an array to accomplish the changing size of the box.

    An increase in level also indicates that more triangles are necessary to fill the box, not only that, but the triangles become capable of attaching to more adjacent triangles than before making for larger and more complicated shapes.

    <img src="http://filesmelt.com/dl/game2.JPG">

  • Hey I love those games >_< I want to play it!

    I know, they're meant for kids, but there's something about them I really enjoy

    if you want chance, you should use random(max).This generates a random number which you can divide by max to generate a chance.

    Then, you'd have to do the stickin' by yourself

  • Hey I love those games >_< I want to play it!

    I know, they're meant for kids, but there's something about them I really enjoy

    if you want chance, you should use random(max).This generates a random number which you can divide by max to generate a chance.

    Then, you'd have to do the stickin' by yourself

    I'll be sure to post it in the creations section as soon as it's done.

    I was wondering, is there a command I could use to randomly generate a number between and including 1 and 100?

  • random(100)+1

  • One way to have the pieces stick is to group them with a private variable. The only tricky part is setting the private variables so that the objects are in a clump.

    I uploaded a working example here:

    http://www.scirra.com/forum/viewtopic.php?f=16&t=7488

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