dop2000's Forum Posts

  • Do what?

  • You can simply add another condition to your click event:

    Mouse -> Clicked on MenuButton

    (and) MenuButton Is Visible

    Or a better solution would be putting all menu events into a separate group "Menu Events" and disabling this group when it's not needed.

  • If it starts and not ticking down, then blackhornet is probably right - your timer is restarting again and again every tick.

    You can add some debug output (for example Browser->Log "timer start") to check if this really is the case.

    You need to update conditions in this event to make it trigger just once.

  • redfoc

    R0j0 recently uploaded a great demo in this post:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I used only the first one.

    But you can install CSV2Array and CSV2Dictionary as well.

  • I'm using this CSV plugin:

    plugin-csv-csv2array-csv2dictionary_t64326

    I don't know what kind of game you are creating, so it's hard to give you any advice.

    Here is a little example I made for another post:

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

    You'll need to install the CSV plugin to run it.

    In this demo there are 2 levels using the same layout. Levels have different items offered in the shop, these items are loaded from the CSV file.

  • Keep "Set angle=Yes" in Bullet properties and replace "Enemybullet Set Bullet angle of motion..." with this:

    Enemybullet -> Set Angle to (self.Angle+random(-15,15))

    So when a bullet is spawned, its angle is initially the same as enemy's angle. Then you adjust it by random number of degrees. And then it will fly in that direction because of "Set angle=Yes" setting.

  • koops

    You can try this behavior:

    You'll need to install it (put into \Construct 2\exporters\html5\behaviors folder)

  • Object - your coin.

    Layer - layer where you want the coin to appear.

    Image point - image point of Enemy object. "0" would be its origin image point.

    It's a common method of spawning and it should work.

    Try running your game in Debug Mode (Ctrl-F4), you'll be able to see what's going on. You'll see if the number of coins increases after an enemy is destroyed, where on the layout each coin is located etc.

  • Have you tried this?

    Enemy-> On destroyed

    ............Enemy -> Spawn Coin

  • The more I learn C2, the less often I use arrays

    Surprisingly, in many situations where you would normally use an array, C2 allows you to do the same easier without them.

    For example, let's assume that your tiles are sprites. You can add a couple of instance variables to the tile sprite, like "occupied" or "objectType" and do something like this:

    Repeat 5 times:

    Pick an empty tile, spawn Neutral sprite on it, mark the tile as occupied, set objectType=neutral.

    Repeat 3 times:

    Pick an empty tile, spawn Enemy sprite on it, mark the tile as occupied, set objectType=enemy.

    Repeat 1 times:

    Pick an empty tile, spawn Friendly sprite on it, mark the tile as occupied, set objectType=friendly.

    And now you have your "array" in a form of 9 Tile instances. You can add more instance variables to Tile sprite and store lots of data for each tile. You can pick/filter tiles using various events, loop through tiles in any order etc.

  • When you are making a game with 100-200 or more levels and have to create each level manually, placing sprites on layouts - this is a very time consuming job. And yes, I agree, in many games this may be the only way to build levels.

    However, in lots of other games (especially puzzle games, which this post is about) you can optimize or automate this task by generating levels randomly, or with data created using some external tool. And this can save you many days, weeks or even months of work.

  • NN81, I never said that having all objects from 100 levels dumped on 1 layout is the right way!

    Read my comment again please.

    On start of each level I create only those objects that I need on this level, using the data from CSV file. It works just as fast and the memory usage is the same as with having separate layouts for each level.

    Also, you can potentially have a million levels with just 1 layout if you do it properly! Can you create a million layouts in C2? I don't think so

  • Short answer - you can't use On Create for this.

    On Create is triggered before the instance is actually created, so many properties and instance variables are not accessible at this time..

    You need to use some other event. Or maybe even add "Wait 0" - this will wait till the next tick, when instance creation is complete.