Santhenar's Forum Posts

  • Aha! I finally found the "all instances" condition!

    Thanks so much!

    Man, this is so cool, it's a pair of lasers which focus in on a single target, and when they converge a super-laser is fired.

    And now it works perfectly!

  • Are you able so shed any light on destroying instances?

    I need to destroy all instances of an object, calling the destroy function multiple times (within a single condition) doesn't seem to have any effect.

  • Haha, I don't believe it!

    Thanks a bunch!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I would be fine with pinning each one individually, but how do I do that since the pin behaviour calls the object type, not the individual instance?

    E.g

    Spawn 'object1'

    Spawn 'object1'

    Pin 'object1' to 'player'

    Pin 'object1' to 'player'

    This will spawn 2 instances of Object1 but will only pin one instance to the player. How can I pin the second instance?

  • Later on, I also need to destroy all instances of the object.

    There must be an easy way to do this, but I can't seem to find it.

  • Hi.

    I have an event sheet which works like this:

    On right mouse down.

    Trigger once.

    Create instance of object.

    Pin object to player.

    This part works fine, until I try and create multiple instances of the object, at that point the pin command only pins one instance to the player (the remaining instances just spawn at the player origin in the layout and remain static) I need it to pin all created instances to the player.

    Any help would be much appreciated.

  • SWISH.

    I have invented Santh's Schizophrenic Seeker-Swarmers

    On Created

    Pick nearest Enemy to (Player.X, Player.Y)

    IF Enemy.Targeted = 0

    [Set Missile.Target to Enemy.UID]

    [Set Enemy.Targeted to 1]

    ELSE

    WHILE

    Missile.Target = 0

    Pick a random Enemy instance

    IF Enemy.targeted = 0

    [Set Missile.Target to Enemy.UID]

    [Set Enemy.Targeted to 1]

    This means that the missiles will target the closest enemy, unless it has already been targeted, in which case they will target a random untargeted enemy.

    It's a pretty decent effect. Especially when fired in bursts. Still needs some fine tuning though.

    Thanks for your help!

  • Oh, and is it possible to add a delay to the "on created" command. So, when an object is created it will wait 1 second before executing a piece of code?

    I want to do this so that the missiles spray out in random directions before acquiring their targets.

    Cheers!

  • Thanks Whiteclaws! But I don't think that gives the effect I'm looking for.

    This code *seems* the same as I had before, and it means that when multiple missiles are fired at once, they will all track the same enemy. I need them all to track different enemies, so if I fire five missiles at the same time, then they will individually track the five closest enemies.

    Here's a screenshot of my missile event sheet: imgur.com/aVLUkUq

  • Hi, I could really use some help with this one.

    Okay so I have a player spaceship which shoots missiles. The missiles chase the nearest enemy and collide and explode, killing them. This all works fine.

    The problem occurs when I want to use multiple missiles. What I want is for the first missile fired to lock on to the closest enemy, and the second missile to lock onto the next nearest enemy, and so on.

    I've given each enemy a variable which shows whether or not they are currently targeted by a missile, but all this means is that while one missile is tracking a target all subsequent missiles refuse to track anything as they all access the nearest enemy instance and find out that it is currently being targeted. I need them to check the next nearest instance, and so on.

    I hope that makes sense.

    As far as I can think, the only way to do this would be with a complicated array storing the distances of all the enemies from the player. However I really don't want to do this for two reasons:

    1. There will be a lot of enemies.

    2. I don't know much about using arrays in C2.

    If anyone could help me with a good method of doing this, or point me in the right direction to start with Arrays, that would be awesome!

    Thanks!