oosyrag's Forum Posts

  • The expression tilemap.tileat(tilemap.positiontotilex(mouse.x),tilemap.positiontotiley(mouse.y)) will return the tile number at the mouse position.

    This information can be found in the manual.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/tilemap

  • Use the timer behavior. Only allow shooting if the cooldown timer is not running. Start timer when firing.

  • Is the correct event sheet assigned in your layout properties?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's an example - dropbox.com/scl/fi/jco9wf5tpcok7vmgx9adt/csssliderbarexample.c3p

    Note that most of the elements use "background" to set the color, rather than "color".

  • What have you tried?

    You're going to need to use the load stylesheet action through the browser object to get at psuedo elements, you can't just use the set css style action for a specific object.

  • It's called a scroll bar.

    w3schools.com/howto/howto_css_custom_scrollbar.asp

  • Usually you loop through a given path in json to find what you're looking for. Then when it matches, you use that path to look up the rest of the keys you're interested in at that path.

    The most efficient way to me is to organize it so that order doesn't matter. You can have all sorts of different json files, and they can all be loaded into memory/parsed at the start of the game, so that you have access to all the data given you know the path or key/attribute you're looking for. Just imagine if all the files were "included" into your project as one file.

    I normally don't have the game modify json files, only json that is loaded into memory. Considering all the files are loaded into memory and the file that they came from is not relevant, then they don't really need to talk to each other. If you need to write back to the json file, then write whatever is relevant.

  • While I'm at it, here's how I would do it

  • Ok sorry, looks like you didn't need UID. You can pick by the instance variable as you originally intended -

    But here's how to use UID anyway if you were to do it that way.

  • The "Pick by unique id" goes in the function, so that the function actions only apply to that instance of the object. You don't need a separate instance variable for it and you don't need to set the uid.

  • It can be. Just pass the uid of the picked instance as a parameter to the function, and add a pick by uid condition into the function.

    Again though, it's just extra steps that you don't need to take to do the same thing, more easily, by just putting the actions in a "for each" event. (Or a "repeat object.count" times as in the example, which is the same thing)

  • Simply put, functions do not preserve picking from the event calling it, unless you pass that information as a parameter. So all the instances of button are being moved to the same position at the far right, overlapping each other, since there are no instances of the button being picked in the function event.

    One of the reasons when not to use a function unless you're doing something where a function specifically would benefit you.

  • igortyhon's example is solid.

    I just wanted to emphasize what he said about not running events every tick (60 times a second on most monitors). If something isn't expected to change every tick, then it's event should not run every tick. Only run the event as needed when something needs to be changed. Try to use triggered events for everything.

    In this example specifically, you don't need to update the buttons until you click to make a new button.

    Also in general, you don't need to use functions for most things in an event based system like Construct. They definitely have their uses, such as setting return values for what basically amounts to a custom expression, or repeating the exact same set of actions under different conditions, but when starting out I recommend working with the basic condition-action event blocks until you run into a situation you really NEED functions. Otherwise, it is just added complexity that you can get unnecessarily stuck on while learning.

  • Glad it made a difference. Especially true since modern hardware lets us get away with a lot, so it's easy to overlook things like this. It works fine, until it doesn't.

  • Wild guess is that you no longer have the correct event sheet assigned to the layout.