jbadams's Forum Posts

  • I'm pretty sure the order is important -- however I've also realised that the most elegant solution also utilises the loopindex of an ordered for loop.

    It's not that I have two separate events, but that I have one event where the instances need to be ordered correctly on each tick: I have a number of sprite instances, and I have a list of coordinates (actually two arrays) that I'm using to adjust the positions of those instances. If the instances were re-ordered between ticks they would be given a value meant for one of the other instances and therefore jump to the wrong position. This has all nicely been solved by using an ordered for loop sorted by IID however, which should be nice reliable behaviour. <img src="smileys/smiley1.gif" border="0" align="middle" />

    To briefly explain, I'm making a game where:

    • The game is played with an overhead view, and the player character is controlled via the 8-direction movement.
    • The player has 6 "turns" to accomplish a set of goals, and each turn has a fixed time-limit.
    • On each subsequent turn, a "ghost player" is spawned which carries out the same actions the player took previously, so that for example on turn 3 there is one ghost for turn 1 and one ghost for turn 2.

    I've got it working beautifully by recording the player's position several times per second and then lerping between those coordinates to reproduce smooth movement of the "ghost" characters. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks again for your input Ashley! <img src="smileys/smiley4.gif" border="0" align="middle" />

  • It's correct and expected behaviour that a local variable will reset to it's initial value each tick. If you need the value to persist you probably want to make the variable static. See the manual entry for variables.

    Alternatively, you could make the variable a global, but that's not something you should do unless your design really calls for it.

  • Thanks newt, I expected as much myself -- and testing seems to indicate this to be the case -- but I want to confirm it rather than rely on an apparent behaviour that might not always work reliably.

    It doesn't matter what the UIDs actually are as long as the logic is always applied to the items in the same order.

  • Each time an event is run, it's action are applies to each picked instance until all picked instances have been affected.

    Assuming I set up an event's conditions so that the same instances are picked each time, can I rely on the instances being affected in the same order each time, or do I need to use an ordered for each loop (sorted by IID) to guarantee the order?

    For example, let's say I have conditions such that MyEvent picks instances we'll nickname Foo, Bar and Baz (which are all instances of MySprite) on each iteration and that on the first pass through the event sheet actions are applied first to Bar, then to Foo, and finally to Baz. Can I rely on actions being applied in the same order (first Bar, then Foo, and finally Baz) on each subsequent pass through the event sheet, assuming of course I don't do anything to intentionally alter that order or pick different instances?

    I know I can definitely achieve this using an ordered for loop, but my event sheet will be a lot cleaner if I don't need to do so.

    Thanks in advance again! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • You could consider putting your project file(s) into version control using Git, SVN, et al. This is how programmers usually do version control, and although most such packages are intended to work with code they'll still allow you to check other file-types (such as your project files) in and out as well.

  • I think the cause is that your array isn't sized correctly to hold the values. Quoting from the manual entry on arrays: "Arrays do not automatically resize. If you access a value outside the array bounds, it returns the number 0. If you set a value outside the array bounds, it will have no effect."

    You can see that you are getting the value "0" returned instead of your array contents as described.

    Have you adjusted the size of your array ("width" and "height" under properties) so that they are the correct size? Even though you're not using it in your example you also need to set the depth to a size of 1 or higher, as if any dimension of the array is size 0 the entire array is considered empty.

    Does that help?

  • It's the same download for free or personal versions, you don't get a different download.

    You need to install the licence file (c2licence.txt) you were provided in an appropriate location -- either in your Construct 2 install directory or in My Documents -- and then re-start Construct2.

    Either find the original email, or copy the file from your older computer. If you can't locate it you could send an email to the support email address with your details.

  • Excellent!

    I know it's a fairly insignificant thing, but given the limited capabilities of some of the target platforms I don't think it would have been unreasonable to spend the 10-20 minutes to write myself a quick post-export script which I could then apply to any and every project I ever create. I'm normally all about higher-level algorithmic improvements rather than micro-optimization, but when something can so easily improve every project with very minimal work I feel it's definitely worthy of pursuit. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Even better that the exporter already handles this and I don't need to do the work at all though!

  • Thank-you so much Ashley, and thank-you again for such a fantastic product with such a quick and regular update schedule! I wish more developers had your dedication and work-ethic! <img src="smileys/smiley1.gif" border="0" align="middle" />

    I think this feature will be very useful for anyone wanting to record input as I'm doing or for implementing "combo" patterns as often seen in arcade-style fighting games.

  • I have an optimization question not covered by the usual performance tutorial.

    Does the exporter optimize the math used in event sheets where possible?

    For example, if a value is calculated by adding two constants together, will the exporter recognise that these values can not possibly change after export and add them to avoid the unneeded calculation at run-time?

    I have a very large number of values initialised in this way, and if such an optimization is possible it could have a significant impact on mobile platforms, so if the exporter doesn't already do this I'd like to create my own tool to do so.

  • I'd like to request the addition of an expression for the keyboard plug-in which returns the last key pressed.

    I'm recording my player's key-presses, and my current approach involves a different event for each key. This would be significantly easier if I could use the "on any key pressed" condition and then use a "last key pressed" expression to identify the key in question.

    It might be too difficult to return some sort of reference or pointer but simply returning the name of the key would be sufficiently useful, as it should then be able to be passed as a parameter to the new function argument.

  • ramones: Thank you so much, I hadn't thought about needing to escape quotes or anything of the sort, but now it's working perfectly. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Ashley: Thanks for the suggestion -- and I might normally agree, that's how I've used JSON previously -- but in this case I'll only be loading a maximum of 2-5 arrays of data that don't need to be dynamically loaded, and I'd prefer to simply hard-code them into my initialisation event rather than adding an additional otherwise unneeded plugin to the project to load them in.

    Thanks again to both of you, and especially Ashley for such a great product! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

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

    The key thing there is that Nintendo didn't seem to care. Just because you didn't see it doesn't mean it didn't happen, and as a rule Nintendo have traditionally been pretty strict about this type of thing.

    I'm a staff member and forum moderator at a very popular game development site (GameDev.Net), and 5 or 6 years ago now after requesting we take down recruiting posts for a few individual projects -- who themselves received C&D notices -- Nintendo actually made a blanket request that we do our best effort to disallow any fan project using Nintendo's properties.

    Just commenting on something above as well, obviously if you re-use an asset (model, sprite, whatever) from an existing game -- even if you modify it -- you're violating copyright. A lot of people don't realise however that if you create a new asset for yourself completely from scratch but based upon something from an existing game you're still creating a derivative work.

  • Hey,

    I'm having trouble trying to fill an array by loading JSON data, are there any need-to-know tips or known issues with this?

    I have one project where I built a simple editor and then place the value in a text field using the .asJSON expression of the array. Everything works fine there as far as I can tell -- the JSON data appears to be alright to me.

    I'm experiencing my problem working with my second (game) project. I have an array with the same dimensions (19,11,1) as the one from the original project and I'm trying to load the JSON data by pasting in the entire string obtained from the other project. I've tried doing this with or without surrounding quotation marks, but I'm getting syntax errors every time I try to submit the dialog.

    My JSON string is as follows:

    ----------------------------------------

    {"c2array":true,"size":[19,11,1],"data":[[["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_door"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_door"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_door"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_passable"],["tile_impassable"]],[["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_door"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"],["tile_impassable"]]]}

    ----------------------------------------

    Any ideas? Would a .capx help to diagnose this particular problem?

    Thanks in advance! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Obviously there's going to be some overhead involved in creating and working with a plugin to achieve your multi-player functionality, so you really have to decide whether or not the productivity gains from working with Construct 2 are enough to balance that out.

    For a single or small number of projects of smaller scope it may not be worth having to spend the time, but if you're planning on using these platforms repeatedly over a number of projects it will probably start to become more worthwhile -- once you've coded your plug-in, assuming you do a good job of it, you should then be able to simply drop it into multiple projects with only minor adjustments where necessary.

    I'd suggest spending a couple of days evaluating the workflow of the free version of Construct 2 and examining the plug-in API so that you can make a more informed decision based on your own needs; only you can really judge how suitable (or not) Construct 2 will be for the types of projects you're working on, and only you will be able to estimate just how much time and effort you might be able to save when compared to working with the libraries you mentioned.