99Instances2Go's Forum Posts

  • There is a range in play here.

    If we normalise the range to '0 - 1', things get easier. To do this we use a scale factor.

    ScaleFactor = 1 / (max - min)

    Since min is zero in your case, ScaleFactor = 1 / max

    Max (in your case) = Sprite.LineOfSight.Range

    Or .. ScaleFactor = (1 / Sprite.LineOfSight.Range)

    Any distance normalised is now DistanceNormalised = (1 / Sprite.LineOfSight.Range) * Distance

    Say the Range is = 300 And we are 200 away:

    (1 / 300 ) * 200 = 0.666

    Say the Range is = 300 And we are 75 away:

    (1 / 300 ) * 75 = 0.25

    So we clearly now have a value between zero and 1, representing the range (normalised), and it is a small number when closer and bigger when further away. So lets reverse that.

    ScaleFactor = (1 - (1 / Sprite.LineOfSight.Range))

    or DistanceNormalised = (1 - (1 / Sprite.LineOfSight.Range)) * Distance

    Only problem now is that things go negative when out of range.

    We solve that by ... DistanceNormalised = max((1 - (1 / Sprite.LineOfSight.Range)),0) * (Distance)

    Distance = distance(button.x,button.y,mouse.x,mouse.y)

    So we gonna add a small random to the button.X and button.y, that is proportional to DistanceNormalised

    random(DistanceNormalised , 0 )

    Set button position to ...

    x = Button.RestPositionX + (ScalarX * ((random( (max((1 - (1 / Sprite.LineOfSight.Range)),0) * (distance(button.x,button.y,mouse.x,mouse.y))) , 0 ))))

    y = Button.RestPositionY + (ScalarY * ((random( (max((1 - (1 / Sprite.LineOfSight.Range)),0) * (distance(button.x,button.y,mouse.x,mouse.y))) , 0 ))))

    Choose a value for ScalarX and ScalarY to your liking.

    Button.RestPositionX is the position for the button in rest, (else he gonna vibrate off screen) stored in an instance variable 'RestPositionX'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can not do this in the way that you have set it up. Nothing is individual accessible.

    Here is an easier direction to go.

    Also, although i love to use arrays, they are not always the best solution.

    https://www.dropbox.com/s/wpkvf6rshyjzh ... .capx?dl=0

  • Bring them on 1 layer and set the layer opacity in stead ?

  • Another way of doing this. Example is not perfect, but shows the basics.

    https://www.dropbox.com/s/8zu69ylvpf0lu ... .capx?dl=0

  • --------+ Spawner: [X] Is Occupied <--- the [X] means inverted (official scirra pseudo code).

  • Yesh, i dont know a better one.

  • Those things are called 'spinners'.

    More accurate info you find by using your friend Google with the search string: CSS: Hide spinners

    But to my knowledge, spinners are pretty hard linked to the browser. Dont think you can hide them with a simple CSS code. Until someone proves me wrong, which would be (again) a nice thing.

    In the mean time, here is a simple way to restrict the input to numbers.

    https://www.dropbox.com/s/c0ohwtlco7zbi ... .capx?dl=0

  • They are a 'form element'.

    They float above the canvas. (in the html script)

    Since they are not 'inside' the canvas, a snapshot of the canvas is not including them.

  • Platform can only jump when on the floor.

    But.

    Due the very rough collision polygons in that circle, the platform is constantly in the state of 'falling'.

    Hence, not on the floor.

    You have to make the collision polygons of that circle a LOT better so it comes a LOT closer to a circle.

    Instead of being just a rough polygon.

    Now, i am to lazy to do that. (that is like making at least 240 points, and moving them in the right position)

    And you did not even try.

    So, lets force the system to make a perfect polygon that is close to a perfect circle as possible.

    https://www.dropbox.com/s/8bgzojbw74ah9 ... .capx?dl=0

    You need a plugin in for this, it will tell you which one on loading.

  • Instance variables and for each do make instances individual.

    Share your project, you must be doing something the wrong way.

  • Bring some fixed positioned 'spawners' in the layout, all instances of the same Sprite.

    Give those a boolean 'Occupied'.

    + System: Trigger once

    + (no conditions)

    -----> Sprite: Destroy

    ----+ System: Repeat floor(random(0,11)) times <-- this is a random between 0 and 10, fill in what suits you

    --------+ Spawner: [X] Is Occupied

    --------+ System: Pick a random Spawner instance

    ---------> Spawner: Set Occupied to True

    ---------> Spawner: Spawn Sprite on layer 0 (image point 0)

    + (no conditions)

    -----> Spawner: Destroy

  • Do not use UID to do such a thing (my opinion).

    Mark a Sprite with an instance variable, or an instance boolean.

    So.

    Give Sprite an instance boolean 'Marked'. (in the layout, in its properties)

    Make 'Marked' true for that very specific Sprite. (in the layout, in its properties)

    Then: When we want to -- by example -- want to change the animation frame of the marked sprite when it is overlapping another instance of that sprite :

    + Sprite: Is overlapping Sprite

    ----+ System: For each Sprite

    --------+ Sprite: Is Marked

    ---------> Sprite: Set animation frame to 1

    --------+ System: Else

    ---------> Sprite: Set animation frame to 0

    + System: Else

    -> Sprite: Set animation frame to 0

  • That is not how 'creating' works. If i understand you right, i still see no tree.

    I have the impression that you try to pick/select an object and then try to create that object.

    Picking an object in a parent condition has totally no effect on which object is created in the paired action.

    Kinda logical, cant pick a non existing object.