dop2000's Forum Posts

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

  • 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

  • [quote:2q55lmdp]May I ask, what does it mean to 'pass the item number to the function'? How would I do it?

    I thought you knew this.

    You can pass data to functions as parameters, for example:

    Call function without any parameters:

    Function call "AddToInvertory" ()

    Call function with one parameter:

    Function call "AddToInvertory" (itemNumber)

    Call function with three parameters:

    Function call "AddToInvertory" (itemNumber, inventoryType, quantity)

    Inside the function you can access these parameters using Function.Param(0), Function.Param(1) etc.

    By the way, functions can also return data. So you can have something like this:

    itemQuantity = Function.Call("GetNumberOfItemsInInventory", itemName)

    You pass itemName to the function, and the function returns quantity of this item in the inventory.

    [quote:2q55lmdp]Grab the note and select it from the inventory without going near Jim, and you can read it!

    I'm irrationally proud of myself right now.

    Yeah, I see it now. Pretty good!

    As for the inventory system, I can't tell you which one I prefer, because I don't have any RPG games with inventory

    If I ever need one, I'll probably create it from scratch. It may take more time, but at least it will be tailored to my needs and I'll have full understanding how it works.

  • Zion

    Again - in terms of performance it doesn't matter how many layouts or event sheets you have.

    Other things are much more important - the size of your images and animations, efficiency of your code etc.

    Large number of layouts will make it harder to manage your project. Imagine you have 100 layouts and decide to make a small change on all of them - this will take an hour! So if you can, you should minimize the number of layouts.

    If your code for 100 levels is basically the same, of course you should not make 100 identical event sheet.

  • NN81, You are wrong. Performance depends on implementation and not on the number of layouts.

    Of course if you dump thousands of objects from all 100 levels onto one layout, this will be bad for performance. But obviously this is not a very good technique.

    Zion

    It depends on you game.

    I'm making a puzzle game with 200+ levels and I only have one layout for all of them. My layout contains all fixed interface elements like HUD, dialog windows etc. and an empty "Game" layer.

    On start of every level I read parameters for this level from a text file (which I made in Excel), and create required objects on the "Game" layer.

    And all this works really fast

  • I think IndexOf() only works with 1D arrays, as it can't return two values for X and Y axes.

    Array->Contains value can tell you if this value exists, but to find its coordinates in 2D array you need to loop through it using "For each XY".

  • Your function is never executed, because loopindex is always =0

    I suggest you add a large text field to your layout and use it for debugging.

    Try for yourself:

    DebugText->Append text "Loopindex:" & loopindex

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need animation frames for different angles. Just keep one frame with the ship facing to the right.

    Then use Enemy1->Set Angle action to rotate the ship to the same angle as your Bullet.AngleOfMotion

    Or you can set "Set Angle=Yes" in Bullet behavior properties and it will fly in the direction of the sprite, i.e. you will only need to change sprite angle. Bullet angle of motion will be changed automatically.