dop2000's Forum Posts

  • So, to clarify - as long as you keep the number of lasers on the screen below 5, you can fire a new laser at any time without any delay. But when there are 5 lasers, the gun becomes unavailable for 2 seconds. Is this correct?

    First, you can use PlayerBullet.count expression instead of BulletsOnScreen variable - this way you don't have to worry about updating this variable when a laser is created of destroyed.

    You can also use "Timer "Bullets" is running" condition instead of CanShoot variable.

    There is a mistake in your second event - "BulletsOnScreen>4" condition runs on every tick while it's true, so the timer is restarted again and again.

    I suggest you create a sub-event inside the event where the bullet is spawned. In that sub-event check if the PlayerBullet.count>4, and start the timer.

  • If I understood your task correctly, you can do this:

    If you have many button objects following the same logic, you can add them to a family and reuse these three events for the entire family.

  • I downloaded the project from the video description and it doesn't have that problem you are having. So you must have done something wrong, it's impossible to say what exactly from your screenshot.

  • I don't get it why you need all that complex code. "On Tap" event is specifically designed for buttons and it checks that the finger has not moved away from the initial location.

    Another alternative is to add a second condition to the "On Touch End" event - "Touch is touching Button".

  • There's likely a mistake in your code. Please post your project file or a screenshot of events.

    You can also check a few examples here:

    howtoconstructdemos.com/category/virtual-joystick

  • Cleaning just browser cache is not going to do it, I believe you need to clean all website data, including hosted app data.

    If it doesn't help, try a different browser, or opening C3 in a private tab.

  • Those are expressions. Every object in Construct has a bunch of expressions, I suggest checking them out, they are super useful.

    You can use "System Compare Two Values" condition for example. The first value being Player.BBoxBottom, and the second value Building.BBoxBottom

    Edit: actually in this case it's better to use "System Pick by evaluate" condition. First you pick all buildings which are overlapping the player, then pick buildings among them which have BBoxBottom>=Player.BBoxBottom

    ----+ Player: Is overlapping Building
    ----+ System Pick Building By evaluate (Building.BBoxBottom>=Player.BBoxBottom)
    -----> Building: Set opacity to 20
    
  • Thank you very much for the example. So depth translates to the different pages?

    It's up to you how you organize your data in table format. Pages may represent a parent object in JSON. (shops in my example above) I also often try to split big arrays into multiple pages, simply because it's easier to read and edit than one huge wall of numbers.

    And of course not all JSONs can be done this way, I have a few plain-text JSON files in my project as well.

  • We're you able to see my other reply to you?

    Looks like I missed it.

    I'd like the transparency to happen when the player is about a quarter or so up the buildings length so it looks the the building is grounded on the floor.

    You can add additional conditions to the "Is overlapping" checks. For example, check that Player.BBoxBottom<=Building.BBoxBottom

    You can also pin an invisible sprite to each building with a slightly smaller collision mask than the building. And check for overlapping with that sprite.

  • Press F12 and check the console log - it should tell you exactly why the project can't be opened.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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