99Instances2Go's Forum Posts

  • Then I tried to add an event like if player is flashing set animation to takehit and it does work but it just plays the frame 0 somehow and it wont play the full animation.

    I suppose player is flashing for some time. Meaning 'if playing is flashing' will be true many ticks. Each tick that it is true, the animation gets set to play from the beginning. So each tick the animation starts (and shows) frame zero.

    Add a system > 'once while true' to the event containing 'if player is flashing'. I suppose you set controls to off while flashing. Thats why the 'idle' kept kicking in. And you do need to cage that 'idle' as you do.

    If you dont set the controlls to off (player can keep moving) then you will have indeed to cage all other animation controls same way.

  • Is ok, i see now that i captured that wrong.

  • It happens on collison with 'Piques'.

    And because you have multiple 'Piques' crowed on a dense place, Perso (player) is colliding with more then one spike in a very short time.

    Each collission triggers a call to the 'mort' function.

    In short: for each spike it collides with (almost at the same time) it makes a new player. And it multiplies because you are getting more and more players.

    Lose all the 'trigger once' for now.

    Give Perso an instance boolean 'IamDeadAllreadyDontBother' (something like that, but in your language) .. false

    (In one event, 2 condtions)

    On Perso collission with Piques

    Perso boolean 'IamDeadAllreadyDontBother' is set ? (inverted, so if not set)

    (actions)

    set boolean 'IamDeadAllreadyDontBother' to true

    call mort

    In the the function "SpawnPerso" add the actions

    Wait 0.5

    set boolean 'IamDeadAllreadyDontBother' to false

    I think that should do it .. code wise.

    But, at the same time i think you better make a spike-sprite with animations for the colors, and frames for the amount of spikes (watch the collission polygones). Those spikes you bring in the layout (not even on runtime) only once anyway, so that should not be that much of work. Set default animation and frame in the instance properties in the layout editor.

    Alternative. Those two suggestions are ways to avoid the problem.

    Bur After all, your solution (fixing it after the facts the way you did) is also not that bad. Is does not harm and is not messing up code. So in fact, you solved it allready, and i understand the cause, every one happy.

  • Would really like to scan his capx, its intriguing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On sPlayerBullet colliding with sTree (if sTree = de family)

    .... this is a trigger .. meaning that it can fire several times in 1 tick and it should have the right sTree in the picklist.

    So yes that would work. If you dont trust it (even my mind says that there are 1000 collissions happen at the same time) then do this.

    (2 conditions in 1 event)

    On sPlayerBullet colliding with sTree (if sTree = de family)

    For each sTree

    (action)

    Call the function (with param)

    'For each' loops trough the picked objects.

    Then again. Fuctions are heaven to condens amount of code lines and (especialy) when you need to pick from scratch without destroying the current picklist. None of those 2 'rules' are in play now.

    You condensed the code by using a family. So. Just.

    (2 conditions in 1 event)

    On sPlayerBullet colliding with sTree (if sTree = de family)

    For each sTree

    (actions)

    All the shaking actions.

    That is even less code because you dont need the code to call the function.

  • Just use that last condition. Pick bird with ChronoCount = 1.

    Now the expression bird.pickedcount is the sum that you need.

    I see (think) that is see that you intended to use sub events, but did not.

    Stuff to read: https://www.scirra.com/manual/128/sub-events

  • I did try putting the 3 objects into a family and having the function affect the family, but it turns out this affects every member of that family.

    Assuming that you pick the right object. Call the function with a parameter, in this case send UID of picked object in a parameter to the function call.

    In the function you just pick family number by UID .. UID = function.Parameter(0)

  • Mega is asking for a key.

  • second CapX, fixed as it should be

    https://drive.google.com/open?id=0B1SSu ... nBUMzFPVVk

  • wrong topic, sorry

  • To know that, i have to read your capx.

    But if i might make a wild guess. There is a player in the layout. You did not destroy it in a 'on start of layout'.

    And you spawn a new player on some place during run time. So actualy, there are two players in the game.

    Assuming there is only 1 player in the game, your code does not pick a certain player. So all actions adress both players. If you move the player, both get moved. So you dont actual see that there are two players.

  • Dont think 'the creating' is a bug. (1st post)

    When you go to next layout, menu is destroyed for memory reasons.

    When you return to previous layout, menu gets recreated, triggering the 'on create' (event 2). The first one was there because of loading gameslot. You have to code that a little differend.

    Move the actions under the 'on created' to the 'createmenu clicked' event block. Created problem solved.

  • Hope this answhers all the remaining questions. I used a container to pair the text objects.

    Basecaly, all you have to do is make every variable 'personal'. Meaning: use instance variables and personal behaviours. Pick based on the instance variables.

    If the conditions pick several instances, and the actions must be private, use 'for each'. Loops trough each of the picked instances.

    https://drive.google.com/open?id=0B1SSu ... ENlSGYwMXc

  • When you look in the debugger, how many players are in the game after the 4th respawn ?

    It shows you the amount of instances.

  • Then you just do, as long as you do not need to pick instances any action will be fine.