0 Favourites

Download Construct 2 release 36

  • Download Construct 2 public preview 36

    Link to release 35

    As promised, this build brings global and local variables!

    However, first of all, there's been an improvement to collisions: now rotated objects overlap when their rotated bounding boxes overlap, as opposed to using unrotated bounding boxes which are always much too big for rotated objects. This makes collisions much more useful now, even though there aren't fine collisions just yet.

    Back to variables: the main change is both global and local variables appear, and are added and edited, in the event sheet itself!

    <img src="http://www.scirra.com/construct2/releases/r36a.png">

    Variables at the 'root scope' (at the top of an event sheet, or anywhere they aren't a subevent) become global variables. These work exactly like global variables in Classic: they keep their value between layouts, and you can use them from any event sheet, not just the one you created it in.

    Variables which are subevents to another event become 'local variables'. You can see in the picture above they have a different icon too. These work slightly differently. They reset their value every tick back to their original value. Also, they can only be used in their 'scope'. This means any 'sibling' subevents. For example, in the above picture, 'MyLocal' can be accessed by any subevents of 'every tick', but not anywhere else. They're intended to be a temporary holding space for calculations, like you might have used a 'temp' global or instance variable for in Classic. Their scope is similar to how scope works in programming languages. This has the advantage that you can reuse names where scope does not overlap. You could have a 'sum' local variable in one subevent, and another 'sum' local variable somewhere else in that event sheet, used for another purpose.

    As an added bonus the expressions panel lists all variables available in the current scope under the System object:

    <img src="http://www.scirra.com/construct2/releases/r36b.png">

    Local variables turned out to be a very complex feature to write - there may be bugs in this version. Let me know if you find any.

    There are three more things to watch out for:

    • You can drag local variables around like ordinary events. However, this changes their scope. This can mean events already using the variable can no longer access it. In this case, those events disappear, and a balloon tip appears at the mouse notifying you this happened. You can just undo this or drag it back and they'll reappear, though.
    • Copying and pasting or dragging around events referencing local variables is tricky, because you can't paste them anywhere outside the scope of the local variables they reference. If you try to do this a message appears and you are prevented from doing it. This could be annoying for day to day use though. Let me know how you find it. Perhaps it could be worked around with a "do you want to add missing local variables?" type prompt.
    • You can't yet put an expression in the initial value of either a global or local variable - this should be added in a future build.

    Anyways, hope you enjoy, let me know if you have any thoughts or more ideas!

    Changelog

    • [Feature] Global & local variables (see above)
    • [Change] Previously collisions only tested axis-aligned bounding boxes. This doesn't work well for rotated objects, which often register collisions when close but not touching. Now collisions are tested with object-aligned bounding boxes (i.e. the box rotates with the object). This is much better for collisions between rotated objects until fine collisions come in future.
    • [Fix] Browsers sometimes hang for a moment while they compile the javascript runtime. This could cause objects to teleport since the value of dt is very large for one tick. This has been fixed by capping dt to a maximum of 0.2 (equivalent to 5fps).
  • YEAH!!! FIRST!!!! WOOHOOOOOO!

    heh jk I hate those twats that do that... local variables will definitely come in handy! Going to try this out now!

  • Great job ! C2 is just getting better and better ! C2 has brilliant future ahead of it

  • Marvelous, I just recently found construct 2, and I think it's coming out great *-*

    Do you have an estimate for releasing the complete one? I have some projects and I want to know if I should wait for construct 2 to be finished ^^

    Thank you very much for your hard work!

  • Marvelous, I just recently found construct 2, and I think it's coming out great *-*

    Do you have an estimate for releasing the complete one? I have some projects and I want to know if I should wait for construct 2 to be finished ^^

    Thank you very much for your hard work!

    C2 is definitely coming along faster than I anticipated, and it still has a long way to go.

    If you have small projects you just want to get going on, I'd recommend Construct Classic, and it will have the added bonus of preparing you for using C2.

    Anyhoo, this is a great addition (in fact, all of the recent builds have been really swell). You guys are really putting things together in a good way.

  • now rotated objects overlap when their rotated bounding boxes overlap

    AWESOME. Been wanting this feature for a while! Is it as fast as normal box collisions, or is it somewhat more computationally intensive than normal box, but still less than per pixel?

    I sometimes get an error:

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

    Construct 2 Check failure

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

    Check failure! This is probably a bug:

    No system expression found when evaluating identifier

    Condition: system_expression != NULL

    File: Projects\ExpTree.cpp

    Line: 657

    Function: void __thiscall ExpIdentifier::Evaluate(class ExpResult &)

    Build: release 36 (32-bit) checked

    Component: Construct 2 IDE

    (Last Win32 error: 0)

    I'm having difficulty reliably reproducing it, but it happens often. It seems to happen when setting a text object's text to a local variable. It also happens sometimes when dragging actions/events. I saved after getting the error here, the error shows on opening the file: http://www.amirai.net/forums/error.zip

    Then after ignoring the above error and moving stuff around the event sheet, I got this error, which might not be important since it only shows up after ignoring the previous error, but I thought I should mention it anyway just in case:

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

    Construct 2 Check failure

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

    Check failure! This is probably a bug:

    Creating deleted status undo point with no elements

    Condition: !project_elements.empty()

    File: Undo.cpp

    Line: 75

    Function: __thiscall ModifyDeletedStatus::ModifyDeletedStatus(const class std::vector<class ProjectElement *,class std::allocator<class ProjectElement *> > &,bool,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &)

    Build: release 36 (32-bit) checked

    Component: Construct 2 IDE

    (Last Win32 error: 0)

    Enjoying the rapid updates!

  • <img src="http://dl.dropbox.com/u/904641/PAWMedia/new/approved.PNG">

    Me likey very much!

  • > now rotated objects overlap when their rotated bounding boxes overlap

    >

    AWESOME. Been wanting this feature for a while! Is it as fast as normal box collisions, or is it somewhat more computationally intensive than normal box, but still less than per pixel?

    It always does an ordinary (axis-aligned) bounding box check first, which is trivial and 99% of the time determines the objects are not overlapping. The rotated-box check is only a bunch of arithmetic though so should be very fast as well, compared to per-pixel checking.

    I think it's worth pointing out there won't be per-pixel collisions in the HTML5 runtime - Javascript isn't fast enough. The Classic runtime uses C++'s raw speed as well as special CPU features to make it practical. There'll have to be collision polygons instead.

    Thanks for the check failure reports, I'll have a look soon!

  • There'll have to be collision polygons instead.

    Are we talking "manually created" polygons or automatically generated?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Both - I'm thinking C2 will try to guess the polygon, and you can manually tweak it if it's not good enough.

  • Instead of per pixel, how about a grid of less points spread out?

    . . . .   instead of      ........
    . . . .                   ........
    . . . .                   ........[/code:2v0bvtzp]
    If that makes sense.
  • Grids of points can overlap with none of their points touching! All the points just fall in between the other points. It won't do at all! Collision polygons are the standard used by physics engines and other algorithms like lighting. We may as well use collision polygons and then you get your physics polygon automatically.

  • Thanks for the update, this new Variables system seems very useful.

  • Grids of points can overlap with none of their points touching! All the points just fall in between the other points. It won't do at all! Collision polygons are the standard used by physics engines and other algorithms like lighting. We may as well use collision polygons and then you get your physics polygon automatically.

    Yeah, that might work. As well, it could certainly make shadows better-quality and, well, actually fit the shapes of the sprites rather than using the bounding box!

    Also, speaking of lights, I imagine lights can be improved in some ways upon their implementation in C2, such as being able to replicate the effect of hanging a light above an object when in top-down view (to cast a shadow on the ground), and for light to either be sunlight (rays are parallel) or closer lights (which don't cast parallel light rays).

    Anyway, collision polygons are a reasonable compromise, as they're used with physics anyway, and in some ways just as effective as per-pixel without being nearly as speed-dependent.

  • Hello, and thank you for this amazing program.

    I have a question:

    will C2 contain a 3dbox plugin like CClassic or not?

    I ask because i`m starting a long-term project and i need to know that to start making the graphics. Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)