Magistross's Forum Posts

  • If you want to force the debug text to be more readable, I guess you could always do something like rounding the value to 5 or 6 decimals (or whatever number you deem significant).

    example for 5 decimals :

    Smaller values will then always be equal to 0.

  • That's the problem with floating point arithmetic. There's nothing you can do about it, you just have to deal with it. However, a number like -1.8369701987210297e-16 is so small that you won't ever notice anything visually... so you might as well consider it to be 0.

  • You are probably trying to use an "else" statement on a trigger. This won't work.

    See the difference here :

  • I made a static XML to try, and it worked fine, but as I wrote I need a dynamic way to get data from MySQL.

    Nothing stops you from building a dynamic XML file from your PHP script. A DOMDocument should work wonders for this.

    See the docs here : http://it.php.net/manual/en/book.dom.php

    Once the document is finished, you can output it as an XML string using DOMDocument::saveXML.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Too bad your forum reputation isn't high enough, I couldn't see any image you posted.

    Your JSON represent an array of objects, which Construct can't interpret. You will have to modify your PHP so it returns something that looks like this :

    {"c2array":true,"size":[10,1,1],"data":[[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]]]}[/code:dcdlqzs8]
    This is the result of a "AsJson" from an empty array.
    
    edit: If it can be of help, this is how your example data should look like :
    [code:dcdlqzs8]{"c2array":true,"size":[10,3,1],"data":[
    [[1],["Jeffrey"],[5]],
    [[2],["Lisa"],[72]],
    [[3],["Pamela"],[31]],
    [[4],["Anna"],[67]],
    [[5],["Antonio"],[28]],
    [[6],["Judith"],[45]],
    [[7],["Billy"],[88]],
    [[8],["Amy"],[76]],
    [[9],["Theresa"],[69]],
    [[10],["Kathryn"],[25]]
    ]}[/code:dcdlqzs8]
  • As per the manual, there is a "Set request header" action that should accomplish what you need. Simply call this before any AJAX post that needs this particular header.

  • I believe he wanted a constant linear speed. Here's my take on it, using your formula.

    https://www.dropbox.com/s/59lavr8k6xsb2 ... .capx?dl=0

  • I'd create a single PHP script that fetch text files and output them. So you don't have to create a new PHP file with "header('Access-Control-Allow-Origin: *');" everytime.

    Also, if the application is hosted on the same server, none of this is necessary.

  • The loop isn't infinite, the game itself is an infinite loop. However, the nature of the event makes the loop grow exponentially (2^tickselapsed). So after a second at 60 fps you would theoratically have 1 152 921 504 606 846 975 new sprites if you begin with one. The system obviously can't cope with this and everything slow down to a crawl and hangs forever after a few ticks.

  • Your best bet is probably a function. 1st and 2nd parameters are the coordinates, and the rest are tile ID that are to be checked.

  • And this formula should append the correct suffix to the number.

    value & ((value % 100) - (value % 10) = 10 ? "th" : value % 10 = 1 ? "st" : value % 10 = 2 ? "nd" : value % 10 = 3 ? "rd" : "th")[/code:2ng1vp20]
  • You will probably have to use a plugin that can readily interpret any JSON thrown at it. (JSON++ by Nandynho, JSON by Yann)

    I guess you could also intercept the JSON before loading it as a Dictionary and turn every value in strings, so they could later be loaded into their own dictionaries... there would still be the problem of embedded-embedded objects... but the same logic could still be recursively used.

  • Updated all links. RIP Dropbox...

  • Are you sure your tilemap isn't bound to the background layer (layer 0) ?

    I just fiddled with layers and its "locked" property along with a tilemap, switching from the locked one to the other... and I get the "rectangle selection" thing only if I'm trying to "paint" on a tilemap that is on a locked layer.

  • The tilemap does have a pencil tool.

    Could it be because the layer the tilemap is on is currently locked ?