mindfaQ's Forum Posts

  • I see, forgot about that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1D-array?

  • I would track all those sorts of things in the instance variables of an array. So make an array (I suggest you also rename it to something like 'experience'), add the instance variable 'exp', 'level', etc. This is just cleaner than using global variables and the array isn't destroyed between layouts like other objects. Also, if you later decide to add levelling for another character, you can just clone your existing array instead of needing to add more variables.

    I don't really understand why you would use an array, but then use instance variables on it when you could add them to the character instead. That would save some picking.

    Although imo a good way to do is (imo) to put the status-array (that contains everything about the character's progress) in the container of the levelable character. So every new levelable character will have his own status-array when he is created, that also gets destroyed when he dies and that is automatically selected, when you pick the character.

  • Use an array where you store all you text. All texts (that are translatable) should be loaded from this array.

    In an options menu where you can set the language you can dynamically load the array of the fitting language from your project files. To do that you can:

    Either use the CSVtoArray-Plugin (you need to download it from this forum), export your spreadsheet with the texts for one language to .csv, copy the string and input it into the game (need to exchange " to "" beforehand).

    Another option is to load a JSON string into the array. To get that JSON file you can use array -> download as json beforehand. Later on include the .json in your project files, add the Ajax-object, request a project file and upon request complete use array -> load from json ajax.lastdata

    But for the second method you obviously need to have the data ingame already. Sure you can also export a blank array with the size you need and then just edit the .json in a text editor and fill it with the texts.

  • Every X seconds is bound to game time (as you've noticed), so if deactivate it and later on reactivate it, every 10 seconds could fire off directly in less than 1 second or it could take up to 10 seconds till it fires off.

    You have various options actually.

    You could use timers (which ofc you can stop and start anew when the game starts again).

    You could use cooldown variables.

    You could write the current time into a variable and then later on substract time-oldtime to find out how much time passed

    example:

    on new game start: set oldtime = time

    system compare - if time-oldtime > 5: spawn stuff, set oldtime = time

  • tlarkworthy: what's the functional difference between this and loading from URL?

  • Thats because Construct 2 "runs" in the direction x -> some y -> even more z

    sorting by x will move x, y and z (because it checks for array.at(index) when sorting)

    sorting by y will move y and z and leave x in place

    sorting by z will move z and leave x and y at place

    so to do what you want, use x as your page index and y and z as your 2 dimensional data table. (you can create a new array and fill it with for each xyz oldarray: set newarray at(oldarray.curz,oldarray.curx,pldarray.cury) to oldarray.curvalue

  • Yeah I've understood that, but was asking which value the panel shows when you are at your last 1-3 pieces.

  • Wrong subforum

    Anyway, which result does this code give back (which value does numpanel have and which numbers are present)?

  • If you want the laser to hit the nearest enemy, use

    Enemy - Pick nearest

    or if you want an enemy with a special propery use pick by comparison or for each ordered (together with a stop loop command directly at first execution)

  • It is not optimal since every 1 seconds uses the global time, so it will happen that the squirrel will not fire the bullet immediately when you come into range. That might not seem that big of a deal in this case, but in other cases where the time intervall is bigger (like 5 seconds) this becomes really inconsistent.

    I'd prefer a construction like (cd = instance variable of squirrel):

    every tick

    cd > 0: substract dt from cd

    distance(hero.x,hero.y,squirrel.x,squirrel.y) < range AND cd less or equal 0: fire bullet, set cd to (your cooldown time)

  • The ones that can't be inverted are triggers and many system events. Stuff like key pressed, collision with, functions, ... . Also loops and some other stuff where it wouldn't make sense.

  • after quite some testing, I found the problem. Seems to be some sort of computational error

    use

    Function.Param(0)+round(cos(loopindex("boomSides")*90))*loopindex("boomRange")

    and

    Function.Param(1)+round(sin(loopindex("boomSides")*90))*loopindex("boomRange")

    when comparing the value in the array

  • sprite.imagepointx(1) and sprite.imagepointy(1)

    1 being the index of the image point, so sprite.imagepointx(0) will give back sprite.x