jbadams's Recent Forum Activity

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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" />

jbadams's avatar

jbadams

Member since 21 Dec, 2011

None one is following jbadams yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies