dop2000's Recent Forum Activity

  • To enter data I use the array editor in C3, because it's convenient and you can copy/paste values from Excel or Google Sheets.

    And then on start of the game I convert this data to JSON, because it's much more flexible and easier to work with than arrays.

    Here is an example, the ShopStock array, it contains multiple sheets for different shops in the game. The first cell contains the name of the shop - "Blacksmith".

    On start of the game I'm loading this data into a temporary array and then parsing it into this neat JSON format:

    {
     "Blacksmith": {
     "copperaxe": {
     "Price": 2000,
     "Materials": [{"ingotCopper":3},{"axe":1}],
     "Quantity": 1
     },
     "copperhammer": {
     "Price": 2000,
     "Materials": [{"ingotCopper":3},{"hammer":1}],
     "Quantity": 1
     },
     "ironaxe": {
     "Price": 5000,
     "Materials": [{"ingotIron":3},{"copperaxe":1}],
     "Quantity": 1
     }
     },
     "Greenhouse": {
     "plantPurpleHeart": {
     "Price": 2100,
     "Quantity": 1,
     "Randomize": 1
     },
    .......
    
    

    I can then access any product in any shop using ShopStock.get("Shop.Product") expression, I can add new keys to JSON, remove products etc.

  • That's pretty terrible and makes little sense. Please change it like this:

    And if you not using those variables (1stplacescore, 2ndplacescore etc.) anywhere else, then you can even delete all sub-events. All you need is just the first line.

  • Oh and is the Trigger in the Systems Action?

    Do not use Trigger Once when you have multiple buildings! This demo explains why:

    dropbox.com/scl/fi/6l697ciwj9frta37b4no4/TransparentBuildings.c3p

  • CHeers. Does On Enter pressed work though if you have multiple input boxes?

    Yes.

    Do I simply put a string "textInputID" into the ID parameter of each textinput object?

    Yeah, you have to give them unique IDs and call this code for each textinput. There are perhaps ways to optimize it, but I don't know JS.

  • It's easier if you use text variables - Loot=sword. Otherwise, if you have many loot types, you'll forget what all those numerical IDs correspond to.

    So if you define this Loot variable on the Enemies family, you can specify which enemy carries which loot, either directly on the layout, or when enemies are spawned.

    When an enemy is killed in Enemies On Destroyed (or in a similar event) you can do this:

    Enemies compare variable Loot=sword : Spawn a sword
    Else Enemies compare variable Loot=gold : Spawn a coin
    

    You can even put the exact name of the sprites which should be spawned in the Loot variable, and then use "Create object by name" action.

    Enemies On Destroyed : Create Object By Name Enemies.Loot
    
  • "On Enter Pressed" still works for me when cursor is in a text input.

    To stop the Tab key to move focus to another text input you can try this code, but it only works with Worker disabled:

  • Here is a solution (not mine) using a bit of JS:

    dropbox.com/scl/fi/nxybw8fjiob5qjurzmg5l/sort_different_object_type.c3p

    Be aware that it may work slower than the system "Sort Z order" action.

  • lilOptionz You don't need to pick instances inside the "For Each" loop. Like I said, this loop processes one instance at a time, so the instance is already picked! Just use "Compare Two Numbers loopindex=0" condition.

    Your events where you are trying to pick players by comparing loopindex make no sense. Also, expressions like loopindex(1)&loopindex(2) are totally wrong, loopindex doesn't take numerical argument.

    And as lionz mentioned, you shouldn't run this code on every tick, make sure it's executed once when needed, for example when a layout with scores is opened.

    Try changing the code like this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you checked memory usage in the Task Manager? It may be a memory leak, I've seen this before, here is an example:

    github.com/Scirra/Construct-bugs/issues/5503

  • Loading images into sprites makes sense for large static graphics, like big backgrounds. If you are planning to load images for all sprites in the game (especially animated), this is going to be a very difficult task.

    I also suggest re-compressing your graphics with PNGQuant after export. It may reduce the size of your exported game by 20-40%.

    I usually disable the built-in image compression when exporting, and then run a batch file which compresses all PNG files in the Images folder. PNGquant is technically lossy, but the image quality is practically the same, no one will be able to tell the difference.

  • Yeah, sometimes it's better to use separate events for each trigger, rather than a single OR-block. If they should run the same code, move it to a function, and call this function from each trigger.

  • The shuffle should choose 25 of the 50 total objects and create them on the corresponding image points.

    If the objects are already on the layout, you don't need Advanced Random for that. You can do something like this:

    Repeat 25 times
    Sprite isPlaced=0
    Pick Random Sprite instance
    .. Sprite set position to ...
    .. Sprite set isPlaced to 1
    
dop2000's avatar

dop2000

Online Now

Member since 26 May, 2016
Last online 4 Feb, 2025

Twitter
dop2000 has 257 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies