Magistross's Forum Posts

  • Laurent I have no short term intention of converting my plugin to C3 but I'll try to see if blackhornet's converter could do the trick.

  • There's the Pointer Lock API that you could experiment with. It's a powerful API that allows for the full disabling of the mouse pointer. However, I believe it can only be activated with an actual user input event.

  • Hey tdcostas

    I tried to create some sort of breadth-first search algorithm to play nice along with my EasyStar.JS plugin. I soon found out that I needed a way to retrieve the cost of a tile if I was to be able to do anything.

    Here's the result and the new behavior files needed to run it.

    In this example, you'll notice that I'm never using any actual pathfinding. You'd use it however to move to a selected tile, but that's the easy part.

    Note that I take for granted that the minimum cost for a tile is 1. That's why I set the "movecost" array size to "MovePoints*2+1".

  • Thanks It feels like I corrected this particular bug for the third time! That's what you get for copy pasting code instead of working with reusable code...

    I finally updated the basic example to behave correcly with the newer version of the plugin (just had to configure the behavior to synchronous mode).

    I also went ahead and added an expression to retrieve the cost from a tile coordinate and a condition to test whether or not a tile is walkable.

    New version here.

  • Using a breadth-first search might be more appropriate to find all possible moves, and then I guess you could use the pathfinding only once to go to the selected tile.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You might want to try your luck with the Browser object's "On supsended" and "On resumed" triggers.

  • It's crude, but you could add an event that unfocus the textbox every tick, and add another one that focus it on any keypress.

  • Hi Mante!

    After you change the spritefont's sprite, you need to make sure the properties properly reflect the new sprite, otherwise some weird stuff are bound to happen. Also, you need to change a few variables accordingly, at the very least, DIALOGUE_LINEHEIGHT and DIALOGUE_MARGIN should be tweaked to smaller values.

    The DIALOGUE_POSITIONX variable represents the top-left corner of the dialogue box, so this value should not be set to a centered point. For the dialogue box to be centered it should be "screenwidth / 2 - DIALOGUE_WIDTH / 2".

    Hope this helps !

  • It's the classic case of "newly created objects can't be picked until the next top-level event". This old post from R0J0hound sums it up.

    What happens is that no array "exists" when the Retrieve function is called after the loading is done. The quickest and dirtiest trick to circumvent this problem is to add a "Wait 0" just before the function call so that it get postponed to the next tick, when the newly created array will be available.

    You could still do it all in one tick, but that would mean adding a lot of logic to your existing to code to now work with the UIDs of the array. Object picking by UID works even with newly created object.

  • You need to use AJAX to load the file. The FileChooser.FileURLAt(0) expression will only give you the URL that AJAX can use to load the file.

    It seemed to somewhat work when I added AJAX file loading, however something was not quite right with the first page. Did not investigate further, you seem pretty capable, you will surely figure it out on your own.

  • However, it's not true in a Construct 2/3 context. Arrays aren't typed and are also dynamic.

  • Well, if you need a simple list of arrays, you could create multiple instances of an array type and treat each instance separately according to its IID (or preferably, an instance variable you set yourself).

  • Yes, it's only a matter of adapting the Sprite Font to display cyrillic characters. The current charset is limited to the default one, however you can expand it as much as you like. Here's the manual entry for the Sprite Font object.

  • Off the top of my head I'd say it's probably related to the order of operations. Try encasing the ternary operator in parenthesis.

    "Hello" & newline & (Variable1 = "Paul" ? "Paul" : "Not Paul")[/code:2fwttllf]
  • Whenever you are doing some sort of calculation every tick, you will most likely need to take dt into consideration.

    Executing "Set X to Self.X + 6" every tick will make your sprite move 6 pixels per tick to the right. Which is ~360 pixels per second on a ~60 fps machine. So if you want your sprite to move 360 pixels per second to the right, whatever the framerate is, then simply do "Set X to Self.X + 360 * dt".