dop2000's Forum Posts

  • 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.

  • Zion

    You need to understand that layouts don't make the game bigger or slower.

    Layouts are lightweight and basically just define the position of objects.

    For example, you have 1 layout with 30 images and your game takes 10Mb.

    If you add 99 more layouts with the same 30 images in different positions, your game will not become 100x times bigger. It will likely only increase 1-2% in size.

    So yes, you can have 100 layouts, but you need to organize them well. Keep all interface elements on separate Global layers. Name your layers and layouts properly, so that you don't have to rename them in the future. And try to use the same event sheet for all levels.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can add a random number to the bullet's angle of motion.

    It could be a simple random(-15,15) on every shot, this will make bullets to fly in 30 degrees cone.

    Or you can do something more complex like this:

    choose(0, random(-5,5), choose(-1,1)*random(20,30))

    This will make some shots 100% accurate, some not too accurate and some very inaccurate.

  • Where do I begin...

    You have a mess with quotation marks:

    ["arbor, arboris","ambulō, ambulāre","commōtus, commōtā, commōtum","diū","e, ex",quīdam, quaedam, quoddam,"nec/neque"],
    [/code:52shp0nl]
    You have different number of elements in each row.
    You have specified incorrect size in JSON.
    
    And finally, your JSON file is saved in some weird code page 1200. Even if you format your JSON string properly, C2 can't load it from this file. Try saving your json file in Notepad with UTF-8 encoding.
    
    Use example from this tutorial to see how JSON should be formatted for string values:
    [url=https://www.scirra.com/tutorials/978/example-load-data-from-json-to-array-and-populate-game-card]https://www.scirra.com/tutorials/978/ex ... -game-card[/url]
  • You need to give more information..

    To publish for what?

    Are you asking how to build a mobile app?

  • You have a global variable Score_Soldier containing high score for this character, right?

    And a Text object (or maybe a SpriteFont, doesn't matter) on your High Scores layout to display this score, let's say it's called Score_Soldier_Text.

    All you need to do in your event sheet is this:

    Score_Soldier_Text -> Set Text -> Score_Soldier

    It's no different to that timer countdown you did a couple of weeks ago.

    Repeat the process for the remaining 3 scores.

  • The link is still incorrect, can't you see?

    Make sure it's not shortened, there should not be any "..." or spaces