mindfaQ's Forum Posts

  • I don't think there is a simple way (you need to put the information somewhere, no matter what). Maybe you can find some regularities (for example, many menus contain a column of 50x200 pixel buttons; then you could do some sort of preset function that knows the position and you just tell it which animation to show for the first, second, third, and so on button).

    Pinning families works. I guess you do something wrong.

  • You could just save your array with the array.asjson expression and in the next session load it back in via load from json action.

    example results of using tokenat:

    tokenat("a;b;c", 0, ";") = "a"

    tokenat("a;b;c", 1, ";") = "b"

    tokenat("a;b;c", 2, ";") = "c"

    You should be able to deduct what's happening ^^.

  • It is set up as transparent by default .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It works in Opera, does not work in NW.js, so different browser engines may either support it or not. Maybe you have changed your preview browser or your browser got updated and changed that somehow. Anyway, in that case I would also suggest to use sprite buttons to ensure supporting every browser out there.

  • I think you only can do it with the screenshotting function, or easier, with the canvas or paster plugin. The key then is pasting the b1 b2 or b3 onto the canvas/paster and then use the image url of canvas/paster in the load from url expression of the sprite a.

  • I also think it is pretty bad that project files don't have any real folder structure...

    But what you can do (for developing / testing via preview mode):

    Use a variable called folder or something. For exporting you will set it to nwjs.appfolder, but for development, you set it to your harddrive folder containing the folder with your assets. Make sure to use nw.js for preview, though!

  • Placing them in the app directory by hand and using the appfolder expression of nwjs in combination with the subdirectory path should be able to lead you to different subdirectories in your app path.

  • Hmm, try:

    1) Run terminal in the linux game directory

    2) chmod a+x nw

    3) run the file, either through your file manager or terminal ("nw" without the quotes)

  • I think you would use your prefered xml editor on the sidelines and after you are done editing, copy it over again into the Construct 2 field.

    (I wouldn't do it either, but wouldn't have a big problem with it ^^)

  • Setting XML directly as a string into loading function would be a horror to edit it later

    Just curious: why? (I'm not saying it is easier maintainable than the variables spelled out in the engine, just don't see a big hurdle)

  • If you don't want to use a project file, but still read from a xml file, you could paste in the contents of your xml file into the xml load action.

    I'm not sure how much minifying does to that string. Perhaps you will still end up with a "hackable" solution, just less obvious. Though imo my philosophy would be "let people hack the game, if it is fun for them", as long as it is single player.

    If you don't want to use project files or pasting file contents in somewhere, I think it only leaves the solutions of setting the values in events / variables.

  • Hello,

    Would it be better to set up the card deck as a sprite with its cards imported as Animation Frames, instead?

    It does not really matter. If you want to animate your cards at some point, the solution with different animations is better. If you don't need animations, then using frames might be a tad easier.

    The while loop and there especially how the i is set up and how it uses global variables make me cringe a bit. So I use code with a for loop instead that's less error prone and imo easier to grasp, because everything is at one place in my example (also it is a function as it should be, since you want the shuffling to be reusable):

    https://copy.com/QXGb4317KtymzkQ9

    What should interest you the most is probably the event that creates the cards and sets the animations.

    For example you could write (with your names mentioned up top):

    "ID_H"&zeropad(deck.curvalue, 2)&"_CardName"

    Problem: if you want to fill in the CardName with an actual card name, this won't work anymore.

    In that case you will need a dictionary or another array, where you store the name, which then you can let C2 read, when it's time to set the animation.

    I'm not sure what kind of properties your cards will end up with. There is also the possibility to just fill an array with all the information, each card has its own x, and then y = 0 would be card name, y = 1 would be animation name and so on. You can read in stuff like this even from a csv file. Just be aware that importing the data from csv will import numbers as string, if you don't explicitly convert them upon adding them to the array.

  • Your php is set up to return the data it received?

  • Well, it's easy to put the names into an array and then you could easily get the name of the terrain with an expression like:

    array.At(tilemap.TileAt(tilemap.PositionToTileX(mouse.X), tilemap.PositionToTileY(mouse.Y)))

    That doesn't change the fact that now your gameplay system still does not know the specifics of each terrain field, so you still need to save that data somewhere, either hard code it into the events or (better) put the data into an array... perhaps in the array you now are already using.

    So if you only have the speed and defense modifiers, you could easily store the name of the terrain at y-index 0, the speedmodifier at y-index 1, the defense modifier at y-index 2.

    and let's say you wanna use your event exampel, then you could write it like:

    Compare Tile At (X,Y):

    * terrain_type = array.at(tile_ID, 0)

    * terrain_speed = array.at(tile_ID, 1)

    * terrain_defense = array.at(tile_ID, 2)

    If you don't know how to use array... there is plenty of topics, tutorials and the manual, where you can learn how to use them.

  • I dont see why you would need 10 events to detect tiles on 1 tile map.