Psynaptik's Forum Posts

  • It's not great to use WeTransfer - those links expire and it means that no-one can access that in the future.

    With dropbox or googledrive you get lots of data for free. Use dropbox preferably.

  • I've found a solution involving adding the UID to the timer name, and passing the UID into the function:

    + Keyboard: On Space pressed

    -> objects: Start Timer "shakeReset_"&objects.UID for random(5) (Once)

    * On function 'resetShake'

    * Parameter 'objectUID' (Number)

    ----+ objects: Pick instance with UID objectUID

    -----> objects: Set shakeAmount to shakeStrength

    -----> objects: Set shakeTimeElapsed to 0

    + objects: On Timer "shakeReset_"&objects.UID

    -> Functions: Call resetShake (objectUID: objects.​UID)

    Hope that helps someone!

    Now, all the instances work independently of each other, and only listen to their own timer (I think...).

  • Save as a .c3p file, upload it to a dropbox/googledrive and post link here.

    Is solid enabled at start on your solid obstacle?

  • What do you mean? In Construct 3?

    It's a 2D engine. 3D is faked/pseudo 3D. So the answer is no.

    Also, you wouldn't ever use a game engine to make an animation really. You're better off using a 3D package such as Blender to make models and animations.

  • Have you checked the collision polygon in the animations tab?

    It doesn't always turn out as you might expect - especially for non-regular shaped objects.

  • I'm still getting the effect where if one timer goes off, it acts on all instances.

    This is what I have that's relevant:

    -------------

    + Keyboard: On Space pressed

    -> objects: Start Timer "shakeReset" for random(5) (Once)

    + objects: On Timer "shakeReset"

    + System: For each objects

    -> Functions: Call resetShake

    * On function 'resetShake'

    -> objects: Set shakeAmount to shakeStrength

    -> objects: Set shakeTimeElapsed to 0

    -------------

    The exact function is the objects shake a little to give some animation/game feel. But I want them to shake at random intervals individually, and not be in sync. I can happily get them to shake altogether, but not independently.

    I'd like each instance's timer to make just that same instance shake a little. At the moment the timer of any instance will make ALL of them shake.

    What have I missed in your answer? Thanks for your continuing help!

  • Ah, I didn't know about the 'for each family' bit. I'll try it and see how it works.

  • Hi,

    I have 3 objects that belong to a family. I have multiple instances of each of those three groups on the layout.

    I have added a timer behaviour to the family.

    I want to set a timer on each object, and a function to fire when that timer finishes.

    I can easily do it so that all objects act in unison i.e. one timer ends and they all execute function simultaneously. But what I want is for them to be out of sync. I want to set a timer on EACH individual object to timerLength+random(timerLength), or similar.

    How do I code it in C3 so that each object acts as an individual, and they don't keep getting messages from every objects timer - which I think is what is happening?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To help others with this issue, this is what I ended up doing:

    I have two families - one has my 'generators' in. The other has my 'generated objects' in.

    For the 'Generators' family, there is a family-level boolean of 'used' (necessary to use so that you don't get multiple objects spawning on the same site).

    ----+ System: On start of layout

    -----> Functions: Call fruitGenerator (generator: "genBerry", fruit: "berry", number: 2)

    -----> Functions: Call fruitGenerator (generator: "genCarrot", fruit: "carrot", number: 4)

    ----* On function 'fruitGenerator'

    ----* Parameter 'generator' (String)

    ----* Parameter 'fruit' (String)

    ----* Parameter 'number' (Number)

    | Local number i‎ = 0

    --------+ System: While

    --------+ System: i < number

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

    ------------+ System: generators.ObjectTypeName = generator

    ------------+ generators: [X] Is used

    -------------> System: Create object fruit on layer 1 at (generators.X, generators.Y), create hierarchy: False

    -------------> System: Add 1 to i

    -------------> generators: Set used to True

    --------+ System: Pick all generators

    ---------> generators: Set used to False

    Thanks again for the help!

  • Wonderful, thanks for that! I have another page to search now!

  • I did try that, thinking that would be the obvious answer, but I couldn't find it.

    Did a search in the page for 'family' and can't find anything.

    Am I searching the right page?

    construct.net/en/make-games/manuals/construct-3/system-reference/system-expressions

  • Thanks, I'll try that out when I get chance.

    I tried a search in the manual to find that expression to see if there's somewhere to look before posting to forums next time, but I can't find it.

    How could I have known about this expression?

  • I have some generators that I want to be chosen at random to spawn some objects.

    i.e. choose 2/5 of (generator) and spawn (object).

    There are a few 'pairs' of these, so I don't really want to rewrite the function several times (and it's bad 'coding').

    How can I use params to pass in object names for those two variables in C3?

    I suppose I use the string param type, but I can't quite work out how to access it for something like 'pick random instance', where you'd usually select a sprite, for e.g.

  • Thanks for the quick reply.

    I think for this instance, I'll just have to duplicate events.

    Not surprised you can do it in scripting/js. I knew I could do it in Unity and c#!

    Glad I didn't spend too much more time on the impossible!

  • I have two sets of objects/variables:

    berry

    berryGen

    berryGenNo (a variable)

    carrot

    carrotGen

    carrotGenNo (a variable)

    I thought I could write a function with 1 parameter for the 'fruit', and then be able to say, for instance,

    for 1 to fruitGenNo

    Pick a fruitGen

    Spawn a fruit

    But I can't seem to make the compound show up as a variable. Using fruit&GenNo or fruit&Gen doesn't work.

    Am I trying to do the impossible? This seemed to be a good use of functions.