99Instances2Go's Forum Posts

  • AnD4D

    I am a bit lost. Meaning, i dont understand why you need the first number. Why the 1 in 1,5 ?

    That '1' is just a virtual number and is in fact just the index on the X-axe.

    Meaning, the array can just be 1 dimensional. No more.

    Instead of

    1,4

    2,8

    3,9

    It will be 4,8,9

    4 on the index 0 on the X-axis

    8 on the index 1 on the X-axis

    3 on the index 2 on the X-axis

    Arrays are zero based.

    If you want the second number, that number is at Array.at(1)

    Want to compare, it is just Compare at X (x=1)

    If you want to scrap the second number just Array>delete .. index = 1 ... Axis = X . The others just shift.

    If you want to insert a number so it will land on the second place ... Array>insert .. value is new number .. index = 1 .. Axis = X .. the others auto shift

    Loop trough all numbers .. just .. for each element .. X

    etc ....

    Let the array take care of that 'first' number. You dont have to. It is just virtual anyway. That is why the Array is how it is made for.

  • So I'm wondering how I can make the action play out like next time you touch the ground?

    Give the player sprite a instance boolean variable. say 'aCtion'.

    Set that boolean to true when the 'action' happens. Now the player sprite 'knows' that 'it happened'. Just have to wait till he hits the floor to start that animation. So ....

    Player > platform > On landed

    ...................... set 'aCtion' to false

    ...................... do that animation thing

  • 'set to number' Means that it does not take any other input (but only when typing in it) then numbers.

    Changing it on runtime with an action still requires only string input.

    (i know that does not sound logic)

  • There is this:

    Thers is de canvas plugin that has this rgbaAt expression.

    Personaly i think that you take this 'problem' as to strict. 'colour' can be presented as an instance variable (or family variable). Either as a string or as a number. Use the variable to pick.

    If you choose to present the colors with a number, you can (to make it yourself easy) create a event sheet without an assigned layout, and include that in your main sheet. Create global variables there like:

    Global variable 'cPurple' ... value 1

    Global variable 'cBlue' ... value 2

    Now if you gonna compare, it is easier to wrap your mind around it.

    if instance variable = cBlue ... then

    You can also set the animation speed to zero. (if you dont have animations). Now you make frames that match with the numbers. Frame 1 = Purple. Frame 2 is Blue.

    Now you only deal with instances of the same Sprite. And do things like:

    Mouse > object clicked > sprite

    Sprite > compare frame > =? > Cblue

    ............. actions

  • It is a number text box.

    No such thing as a 'number TextBox'

    The TextBox plugin only accepts strings. Nothing else.

    The Text plugin can translate numbers to a string and display it as such.

    See if this shines some light :

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

  • If you dont want to use a 3th party plugin, you can always use a Dictionary.

    (personaly i very much like the BHT Smart Random plugin)

    Clear the Dictionary

    While

    Compare 2 values > Dictionary.KeyCount ... is less then the amount of numbers you want (i suppose 7)

    Local variable 'r' / number

    ..........actions ... set r to floor(random(0,8))*10

    ...........................Dictionary add key .. key is zeropad(r,2) ... value = r

    Now you have a dictionary containing randoms with no duplicates.

    How i did it before the plugin.

  • Got make a 'mental switch' here.

    You select (pick) the objects with conditions, the actions work only on the selected objects.

    So, say you have a sprite 'ship' and a sprite 'sail'.

    Give both a instance variable 'PinID'.

    Create the ships, and assign a number to its PinID.

    Create the sails, and assign a number to its PinID.

    Now all is set up. Now we gonna pin them. Starting with selecting those we want with conditions.

    System > conditions > For each > 'ship' ( this picks each ship one by one)

    in the same event > 'sail' > compare instance variable ... dropdown = PinID ... comparison = equal to .. value = sail.PinID (this ads the sail with the same PinID to the selected objects list.

    Now the actions ........ Set position sail to ship

    .....................................Sail > pin to ... ship (the action has no choice then to use only those 2 selected objects)

    Alternative:

    Use containers.

    https://www.scirra.com/manual/150/containers

    If you have no intention to destroy 1 of the pinned objects while keeping the other in play, you are better of using containers.

    Why ? You only need to create the ships. The sails are auto created on the moment that you create a ship.

    Want to pin them ?

    When you select a ship, the sail is auto selected to.

    So pinning goes like ...

    For each > 'ship'

    ........ sail Set position to ship

    ..........Sail > pin to ... ship

    Also later on in the game. When you select a sail, its companion ship gets selected.

    Say, when a sail gets hit by a button, you want the ship to lose speed.

    On 'bullet' collision with 'sail'

    ..... Set speed of ship to lower (ship is autoselected because you selected a sail)

    Hope this helps.

  • Are you importing it into a TiledBackground?

    Or. As a Sprite Strip into a sprite ?

    https://www.scirra.com/manual/53/import-sprite-strip

  • The plugin draws a (virtual) line from start point to end point. (you dont need to actual draw that line)

    When that line intersects with an 'obstacle', the expressions Trace.HitX & Trace.HitY will hold the exact coordinates of that intersection.

    Trace.UID will hold the UID of that obstacle.

    So, yes, it detects obstacles only.

    Where 'obstacles' is the description that the author of the plugin gave to what you would like to see named as 'targets', i understand.

    The plugin (although based on) is not a Line-of-sight detector, it is basically the opposite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is exactly what you look for. (if i understand what you want)

    Populate the array with the 8 directions. Give the sprites an instance variable 'direction' (text)

    I suppose you have 8 Sprites.

    For each 'sprite'

    ................... sprite > set instance variable 'direction' to BHTSmartRandom.Next

    They all have now a random chosen non repetitive direction. No idea why you need to distribute with a value.

  • In general all events come the same form.

    A condition that picks objects (the basic picklist is made in the first condition)

    (in the same event, or as sub) A condition that starts picking from the basic picklist and refines

    (in the same event, or as sub) More conditions that start picking from the refined picklist and refines

    .......................... actions

    In your case.

    'Bullet' is overlapping another object 'Sprite'. (now the basic picklist contains 3 sprites)

    'Sprite' > pick top/bottom

    or

    'Bullet' is overlapping another object 'Sprite'

    system > pick random instance 'sprite'

    or

    'Bullet' is overlapping another object 'Sprite'

    system > pick nth instance 'sprite', instance = zero

    or

    'Bullet' is overlapping another object 'Sprite'

    Sprite > pick nearest to bullet.x .. bullet.y

    The second condition always starts picking (choosing) from those picked in the first condition.

    So, it always starts with those 3 'sprites'.

  • Escape ?

  • You try to import a Sprite Strip.

    A Sprite strip looks like this:

    Now.

    Number of horizontal cells = frames horizontal. In this case 4.

    Number of vertical cells = frames vertical. In this case 2.

  • Sprite is on screen

    Else

    .................actions