Johncw87's Forum Posts

  • I think 9-patches are what you are looking for.

  • Great plugin!

    It is better then my light behavior, since my behavior could not get normal vector well.

    I'm glad you like it.

    Feature request:

    Since there has input vector and normal vector, how about adding another expression to get reflection vector?

    Added. Example has been updated too.

  • I'm not sure what your particular implementation of "delegates" means or does. However the main point of fast triggers is to avoid iterating every trigger of that type. Normally firing a trigger runs every associated trigger in the event sheet, but fast triggers pre-filter by the first parameter. So running a function does not have to check every "on function" event in the project only to pass on most of them because they have a different function name - it only iterates the "on function" events it knows have the right name to begin with. This prevents there being a performance overhead to the "call function" action proportional to the number of "on function" events in the project (which would make functions slower the more you used them).

    I recall reading some forum post or article from years ago that claimed that the official function plugin suffered from this exact performance issue you talked about. I'm glad to see that you came up with a solution for it, though I think you should have it documented somewhere, to clear up misinformation about it.

  • Traces (or raycasts, if you prefer) are line intersection tests which can be performed by every major game engine, and are very useful for getting information about an object's environment. However, detailed line traces are something that Construct 2 has been lacking. I've seen a few attempts at line traces done in events, however, they weren't very pleasant to use.

    So, to rectify this, I started on a trace plugin, based in part on the line-of-sight behavior. Just like the line-of-sight behavior, you can filter the trace to either solids or a custom list of object types, and you can tell it whether to use collision cells or not. It currently only does line traces, with hull traces planned later.

    The plugin has a couple of actions to manage the custom object type list, and 1 action for performing a line trace. The result data from the line trace is stored in the plugin object, and can be accessed via expressions. This currently includes hit position, the normal angle of the line it hit, and the UID of the object that line belongs to. The trace result persists until the next line trace is performed.

    Last updated: 2016-11-25 9:27 PM PST

    Download

    Preview (Drag the endpoints around, and observe the results.)

    .capx

    DISCLAIMER:

    The plugin provided here is just the first thing I made that worked well enough for my purposes. No real attempts at optimization have been made, other than copying some design patterns I saw in the construct 2 runtime. Using it in a large project is not recommended at this time.

    Now, I have a question for ASHLEY. Why is this not default functionality? Traces are too useful for a game engine to not have.

  • I'm getting this too with Release 185. I assume it has something to do with me installing Java 8 recently.

    EDIT:

    Uninstalled Java 8 and now it works fine.

  • I don't need a workaround. Picking by UID works just fine as a workaround. However, this bug is a very unintuitive behavior of object picking that trips up even the more experienced construct 2 users, as seen here. It's like one of those silly exceptions in English. "I before E, except after C..." followed by a bunch of exceptions few people care to remember.

  • Thank you so much ggibson1 !! That fixes it. For some reason picking does not work as I thought it should under the context, and although I'm not sure "why" picking is being weird, selecting by UID does fix it and makes everything work as normal! Thank you!

    This behavior feels like a bug, so I made a report.

  • Problem Description

    After creating an object, it will not be available for object picking in triggered events until the next tick (pick by UID still works)

    Attach a Capx

    https://dl.dropboxusercontent.com/u/207 ... cking.capx

    Description of Capx

    Clicking anywhere spawns a sprite on the left side of the screen. It travels to the right.

    It sets the width to 4. It should also set the height to 4, and turn it from red to blue.

    Steps to Reproduce Bug

    • Run project.
    • Click anywhere.
    • Observe size and color of the box.
    • Click again while the box is still on the screen.
    • Observe size and color of both boxes.

    Observed Result

    The created box is still red and 16 pixels high.

    Expected Result

    The created box should be blue and 4x4.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7 Home SP1 (x64)

    Construct 2 Version ID

    Release 180 (64 bit)

    Release 183 (64 bit)

    Additional Notes

    There may be more cases where this problem manifests, ones that don't involve triggered events at all.

  • The picking system may be a little complicated, but if you only have one instance of an object type, you don't have to worry about it at all.

    EDIT:

    Actually, I was just reminded of a certain behavior that might be tripping you up. If you create an object, and then in a different event on the same tick, try to use an action on it, it won't work unless you had picked it by UID. All other forms of picking don't work properly for objects that were created in the same tick.

  • If you see the above code, the majority of it is eval statements and console logs. Me and the chrome debugger spend many hours together every day. All javascript objects are populated correctly, but return values all return '0' for all arrays/dictionaries on get/haskey. Unless you can tell me how to specifically watch the process where the C2 engine is getting this 0??

    Well lets start off by finding the code for the Dictionary 'Get' expression. It would, of course, be in the plugin for the dictionary. That means it will be in Dictionary_plugin.js (in preview mode). Looking through the file, you can see all kinds of function definitions for the conditions, actions, and expressions. Eventually you will see this:

    Exps.prototype.Get = function (ret, key_)
    	{
    		if (this.dictionary.hasOwnProperty(key_))
    			ret.set_any(this.dictionary[key_]);
    		else
    			ret.set_int(0);
    	};
    [/code:19c4bika]
    
    So if it can't find the key, it returns 0. Why can't it find the key? A quick google search tells me that hasOwnProperty is a built in javascript function that tells you if a value exists on an object. So how do we know if the value exists? Set a breakpoint on the line that calls hasOwnProperty, and trigger your broken event (Firefox seems to be really bad at setting breakpoints, use Chrome for this). The browser will stop the game when it calls the Dictionary Get expression (from any part of your event sheet). At this point, hover your mouse over the 'this.dictionary' text, and it will show you all the values that are in it, and if you hover over _key, it will tell you what value it is trying to get. You may be looking at any one of the calls to this function that your event sheet triggers, so it may or may not be the one you are looking for. If not, tell the browser to continue, and it will show you the next call. What you do from here depends on what you find out.
  • If you look I also had to make buffer variables to hold on to the parameters because the parameters DISAPPEAR!!!!! if I try to use them in a sub event. I am completely not understanding scope or how this works or something.

    Well this is an easy one. Functions are triggered events, and function parameters are only good during that triggered event. But when you use a wait action, everything that happens after it is no longer inside that triggered event. It has been scheduled to run at a later time, and then does so. It does not matter that the wait time is 0.0 seconds, it will still kick the following actions and sub-events out of the triggered event and cause function parameters to fail.

    As for your dictionary problem, my recommendation is to get very friendly with your browser's javascript debugger. Run your project in preview mode, and try to find the javascript functions that correspond to the condition and expression that are failing. Set a breakpoint in them right before you trigger something that you know isn't working properly. Then try to use the available information in the debugger to see why it isn't working.

  • I tried to add a comment here, but I get a message about how it "looks like spam".

    http://www.scirra.com/arcade/action/175 ... o-bros-1-1

    This is the comment I tried to post:

    > Perfect . How did you do that?

    >

    With lots of care and effort.

    For Mario's movement, I referenced an image I found that detailed his various speed and acceleration values for every possible state. I also wrote a Lua script for FCEUX which would show me the position and speed values of enemies in real-time. For more complicated behaviors like Bowser, I referenced a disassembly of the game. For most everything else, I stepped the emulator frame-by-frame to carefully observe the game's behavior.

    If you are interested in the source, I recently uploaded it to Mario Fan Games Galaxy.

    I don't see how this could "look like spam". This also happened with another game I tried to comment on (the really horrible Mario game that is somehow in the top 5 on the arcade). I think the website may have banned me after this last attempt to post a comment.

    Could Tom or Ashley look into this?

  • What I would like is the ability to mark events and actions with some sort of marker as so

    *image here*

    in order to specify whether or not the code will only be active in debug mode only, and left out of any export version.

    There is already a condition for this. It is called "Is in preview".

  • Here we go again, another bug with this condition!

    Problem Description

    If a non-looping music file is allowed to play to completion, the All Preloads Complete condition will never become true.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/207 ... test3.capx

    Description of Capx

    Starts layout 1. Sets text to "Preloading". Waits for preloads to complete. Starts to play Music1. Sets text to "Preloads Complete". Waits 6 seconds. Goes to layout 2, and repeats all the previous things (but with Music2).

    Steps to Reproduce Bug

    • Run capx preview in FireFox.
    • Wait 6 seconds
    • See layout 2 stuck on "Preloading"

    Observed Result

    After playing Music1 and changing to layout 2, text gets stuck on "Preloading"

    Expected Result

    After playing Music1 and changing to layout 2, text shows "Preloads Complete" and Music2 starts playing

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (YES)

    Operating System and Service Pack

    Windows 7 Home SP1 (64 bit)

    Construct 2 Version ID

    Release 178 (64-bit)

  • Try Construct 3

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

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

    The "All Preloads Complete" condition becomes true too early on Chrome for Android

    Attach a Capx

    https://dl.dropboxusercontent.com/u/207 ... test2.capx

    Description of Capx

    Preloads a long sound, waits for preloads to complete, and then plays it. It also tries to grab the duration of the sound.

    Steps to Reproduce Bug

    • Preview the capx over WiFi.
    • Use Chrome for Android to view the preview
    • Observe result.

    Observed Result

    Preview reports that preloading is complete, and the sound duration is 0. Shortly after, the sound begins playing.

    Expected Result

    Preview reports that preloading is complete, then reports the sound duration as 25.5557918549 (or something close to that) while simultaneously playing the sound.

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (NO)
    • Node-Webkit: (NO)
    • Chrome for Android: (YES) (Also affects Crosswalk export)
    • FireFox for Android: (NO)

    Operating System and Service Pack

    Windows 7 Home (64-bit)

    Android 4.3 on a Samsung Galaxy S3

    Construct 2 Version ID

    Release 178 (64-bit)

    Also tested Release 177 (64-bit), still a problem there.

    Additional Notes

    If I remove the 0.5 second wait after preloads are complete, it will often report the duration as 0 on the above browsers that I state are not affected. While this is not a big issue for me, it may be a problem for someone else at some point.