mekonbekon's Forum Posts

  • The easiest way would be to use a sprite object instead of tiled background; the tiled background object is best used for smaller, repeating images.

  • 99Instances2Go

    Good point, I hadn't noticed that it was a sub-event.

  • You're welcome

  • Is the cloud object in a container with the enemy? If not then the cloud shouldn't be destroyed with the enemy, and there must be something else in your code that is destroying or moving it (check the debug to confirm that cloud is actually being destroyed).

    If the cloud is in a container with the enemy then it will be destroyed with the cloud, because that's the way that containers work. Off the top of my head here are a couple of workarounds:

    1) Rather than destroying the enemy immediately, set it to invisible and start the cloud fading; when the cloud has faded out then destroy the enemy. You will need to disable the collisions and/or use an instance boolean to differentiate the "kind of dead" enemy from living enemies so that it doesn't continue to respond to enemy events.

    2) Before destroying the enemy spawn a new "fadeCloud" object in the same position as the cloud object - this just has the fade behaviour on it and destroys at the end of the fade.

  • As far as I understand it, there isn't a way to batch replace one variable for another, but if you're wanting to replace an object with another object:

    Select all the events and actions with that object in it, right click on the selected code and select "Replace object".

    You are offered the choice of which object to replace: Pick Character1 and then on the next window pick Character2 to swap.

    This will only work if both objects are the same type and all the behaviours and variables for Character1 that are referenced in the selected code are also present on Character2.

  • Yes, if you want to add one per enemy it is best to have the "add 1 to killed" action on the "On destroyed" condition.

  • Extending the fade mask concept that SoldjahBoy proposes:

    I normally add a layer named "Fade" to the each layout in my project, set it to the top layer, mark it as global and then add the fade mask to it. That way the fade always sits on top of all layers and I only have to add the fade mask once. You can then create a function to fade the "Fade" layer itself or add the fade behaviour to the mask and call the behaviour each time you want to fade in/out.

  • If you have more than one Enemies: Destroy action in your code under different events then it can simplify your code to use "On destroyed".

    Using "On destroyed" can also get around some problems with multiple enemies being destroyed in the same tick; if the "Add 1 to Killed" etc actions if are placed in the same event as the destroy action they would only be triggered once regardless of how many enemies were destroyed. Whereas "On destroyed" ensures that those actions trigger for each enemy.

  • marcinkowski Do you have a capx you can share?

  • 1) The enemies.live <10 is unnecessary: enemies.live <20 already includes <10

    2) You need to put your trigger once beneath the enemies: Live <20

    3) Before pinning an object you need to move the object into position and then pin it.

  • Here are a couple of ways you can do it:

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

    In method 1 each spawner is constantly checking the distance to the avatar and updating its distance instance variable - if the avatar comes within range it spawns an enemy.

    In method 2 the avatar has a range sprite with a radius of 100, and the spawner spawns an enemy on collision.

    In both methods I've restricted the spawner to only spawning once by checking their "enemies" instance variable. You can increase this to spawn more enemies per spawner, or eliminate the the condition "spawner.enemies>0" to spawn an enemy every time the avatar comes withing range.

  • The number of layers in a layout should have minimal effect on performance, but having a large number of sprites doing lots of stuff and lots of large images on sprites/backgrounds will.

  • Seems to work okay:

    https://www.dropbox.com/s/056gwrah4f6as ... k.c3p?dl=0

    You don't need the spaces.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi imothep85

    I haven't used the joypad plugin, but I would guess that you could use:

    Axis(Gamepad, Index)

    ...to move an invisible object on the screen, and then use the co-ordinates of that object in place of the mouse (x,y).

  • There's an example project already bundled:

    Select new project and scroll down to Example: Touch - zooming