codah's Forum Posts

  • Personally I hate populating arrays one at a time like that. Also is the id just +1 from the array index at all times? I'd make a function to initialize in a cleaner way.

    Start of layout

    function call "initGun" (1, 10, 400, 1)

    function call "initGun" (2, 5, 400, 1)

    function call "initGun" (3, 40, 300, 3)

    function call "initGun" (4, 100, 200, 10)

    On function "initGun"

    GunArray Set value at (function.param(0)-1, GUN_ID) to function.param(0)

    GunArray Set value at (function.param(0)-1, DAMAGE) to function.param(1)

    GunArray Set value at (function.param(0)-1, SPEED) to function.param(2)

    GunArray Set value at (function.param(0)-1, FIRE_RATE) to function.param(3)

    And you can also make a comment by adding another parameter that you don't use. ex:

    Start of layout

    function call "initGun" (1, 10, 400, 1, "pistol")

    function call "initGun" (2, 5, 400, 1, "rifle")

    function call "initGun" (3, 40, 300, 3, "shotgun")

    function call "initGun" (4, 100, 200, 10, "pea shooter")

    If I had an immense amount of guns I'd go a step further and add a txt file to the project that I'd load and with ajax and parse the data from it with tokenat().

    agreed but I thought that's another converstation

  • Paradox and edwardr

    if I had 4 columns of a "Gun" array: gunID, damage, speed, firerate

    Global constant number GUN_ID = 0

    Global constant number DAMAGE = 1

    Global constant number SPEED = 2

    Global constant number FIRE_RATE = 3

    so it reads:

    GunArray Set value at (0,GUN_ID) to 1

    GunArray Set value at (0,DAMAGE) to 10

    GunArray Set value at (0,SPEED) to 400

    GunArray Set value at (0,FIRE_RATE) to 1

    GunArray Set value at (1,GUN_ID) to 2

    GunArray Set value at (1,DAMAGE) to 5

    GunArray Set value at (1,SPEED) to 400

    GunArray Set value at (1,FIRE_RATE) to 1

    GunArray Set value at (2,GUN_ID) to 3

    GunArray Set value at (2,DAMAGE) to 40

    GunArray Set value at (2,SPEED) to 300

    GunArray Set value at (2,FIRE_RATE) to 3

    GunArray Set value at (3,GUN_ID) to 4

    GunArray Set value at (3,DAMAGE) to 100

    GunArray Set value at (3,SPEED) to 200

    GunArray Set value at (3,FIRE_RATE) to 10

    ahhhhh I feel better..

    I consider this best practice, it can be called 'self-documenting code' BTW it's the rows not the columns, and of course you can also do it for the columns (i.e. PISTOL=0, SHOTGUN=1, RIFLE=2 etc). So,

    GunArray Set value at (PISTOL, GUN_ID) to 1

    GunArray Set value at (PISTOL, DAMAGE) to 10

    GunArray Set value at (PISTOL, SPEED) to 400

    GunArray Set value at (PISTOL, FIRE_RATE) to 1

    and you can use these everywhere, not just when initialising the array. Also not meaning to be pedantic but, #defines for constants in C++? ... hmm don't do it

    [quote:3qjjiam2] and I make them all caps as well.

    edit: just remembered, C2 forces constant variables uppercase

  • The c2.addon file is designed specifically to make it super easy. All you have to do is drag and drop the file onto the Construct 2 window (so, have it running), and C2 does the rest. No creating folders or anything.

  • Great effort man.. I had a couple of plays but I'm not sure how well I did.

    PS: I agree about so much text, I didn't even get time to read it! Also in the mission briefing. And check your spelling and grammar, e.g. "Steer", "Right"

  • You're picking PlayerCards based on an X, Y position, then further filtering any that were picked by another condition (PlayerCards.right > EnemyCards.left). You're not picking EnemyCards, you're just using them in an expression. Maybe you could post your capx or a cut down version.

  • Good work sharing this. Given C2's target market I think this kind of behaviour should be built in.

  • For the first two at least, be sure to check out the FAQ

  • Cant open the capx, I do not have the spritefont+ installed.

    But I imagine you have the ajax plugin doing a request or post and its not working.

    Hitting Ctrl shift J gives you the error console in chrome and FF.

    I forgot about the cross domain policies.

    Sites generally have cross domain security enabled. (origin access)

    So the ajax is not the best solution unless your trying to fetch info from one of your own sites on the same domain or sites having all origin access set to *

    You could use a hidden Iframe, load the page, and fetch the html from the frame with a bit of javascript.

    yeah sorry I use SF+ by default.

    Yes it's an Ajax request and Ajax.lastData comes up empty. You're right, I checked the Chrome console and it says "No 'Access-Control-Allow-Origin' header is present on the requested resource."

    Sorry to be clueless but could you give a bit more info on how I would go about the iFrame technique?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • MarkusR

    You shouldn't really edit or delete your original post as it makes the whole thread nonsensical.

    Even if it is just an honest mistake, it would still be useful for people who search, having made the same mistake, to be able to find the answer.

    #mypersonalopinion

    Definitely! And I'd advise asking on the forum before posting a bug

  • ups, thought there was only one object in condition there pop ups the selection for the new one.

    thank you codah

    can close.

    It's an easy mistake to make

  • First you have to choose the object "to be" replaced,

    [attachment=1:30jv027b][/attachment:30jv027b]

    then you can choose the object to "replace it with".

    [attachment=0:30jv027b][/attachment:30jv027b]

  • (Do)DonPachi series -

    Edit: Not to mention best boss warning ever:

    I'd never heard of this game so did a quick search and found that

    [quote:34txe1lv]the message at startup warns that anyone caught playing the arcade unit outside of Japan would be prosecuted "to the full extent of the jam."

    It's from this top 10 list from 08 (it got #3)

  • I think it will be available until the new one is active.

  • So what should I expect from this code?

  • If I upload to production I need to deactivate my existing ones. That's the way I do it, maybe there's a better way.