Nepeo's Forum Posts

  • working on an AI system, all done via events & using only default addons to make it work, right now I all AI characters can use any melee weapons so far.

    oh yeah the eyes are just there for debug purposes, just representing where the character is looking.

    Nice, looks cool! Is it based on edge detection and line of sight?

    I've had a look for path finding for platformer games in the past, but the examples I saw required marker objects for AI to find how to jump from one platform to another.

  • Looks like something isn't quite right, the concept is pretty sound. Here's an example

    dropbox.com/s/gqd4ipsh8f3ifjs/Random%20Colors.c3p

  • Truly random colors can often be unpleasant. A trick I have used in the past is to blend the random color with another one, so that colors you create have a common base.

    rgbEx(
    	lerp(50, random(100), 0.4),
    	lerp(50, random(100), 0.4),
    	lerp(50, random(100), 0.4)
    )
    

    That blends a random color with the fixed color rgb(50%, 50%, 50%), with a blend ratio of 40%.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • globalThis is quite new. It's not supported in Edge yet. It was created to workaround the fact if you wrote JS for multiple environments ( like a server and the browser ) they used different names for the global object.

    From MDN:

    Historically, accessing the global object has required different syntax in different JavaScript environments. On the web you can use window, self, or frames - but in Web Workers only self will work. In Node.js none of these work, and you must instead use global.

    The this keyword could be used inside functions running in non–strict mode, but this will be undefined in Modules and inside functions running in strict mode. You can also use Function('return this')(), but environments that disable eval(), like CSP in browsers, prevent use of Function in this way.

    The globalThis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. Unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. In this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.To help you remember the name, just remember that in global scope the this value is globalThis.

    I think the C3 runtime will create globalThis if it doesn't exist. But it depends where you're reading it from I guess.

    If you're only doing this in the browser it makes sense to just use window/frame.contentWindow.

    Edge is being replaced with a Chromium based version very soon, so it will have support for it then.

  • You could use foreach (ordered) and local variables to keep track of the previous position.

  • That's great news, thanks for confirming boulerzzz

  • Ah yeah so the first link is the manual for Construct 2. Because it's been around for quite awhile it often appears high on Google searches and the like. Quite a bit of the manual content is similar for C2, but for C3 you want the C3 manual which is on Construct.net not Scirra.com.

    That second link is a guide made by a user for C2, I have no idea if it works or not. But things have changed a lot.

    Unfortunately for any software product that has been around for long enough, and changed during that time, it's inevitable that you will end up with outdated tutorials around on the net. There's not much we can do about it.

  • Might be worth checking if you actually have enough space to save the file to your cloud storage?

  • The build service will validate that icons are the size their names suggest, as cordova will fail with a cryptic message if the size is wrong.

  • opengameart.org has quite a wide range of assets, not all of it is amazing though so it can take a while to find what you want.

    I quite like Kenney assets, tend to be very high quality and they have a wide range of content. I'm not sure if they have anything that counts as "sci-fi" though. kenney.nl/assets

  • pjdegrieck could you link me to the tutorials you were using?

  • Your script

    MyFunctionInsideTheConstruct3Canvas = function() {
    	alert('Works!');
    }
    

    Is a declaration in the global scope of the iframe. The global scope is unrelated to the canvas, which is why you cannot access the declaration.

    Looking at some of the labels here I think it's worth going over some definitions:

    • HTML element: a component of a document, there's lots of types and they in turn can contain other HTML elements. examples include images, iframes, canvas, text and buttons.
    • document: a collection of HTML elements, a browser tab shows 1 document.
    • iframe: a type of HTML element that can contain a document, allowing to place a document within a document.
    • canvas: a type of HTML element which is similar to an image, but has various methods that allow you to modify the contents of the image.
    • variable: (JavaScript) a container for a value
    • function: (JavaScript) a unit of code that can be run repeatedly, by another piece of code
    • scope: (JavaScript) an area in which variables and functions are declared
    • nested scope: (JavaScript) a scope, within another scope. it can see the contents of all the parent scopes, but the parent scopes cannot see the contents of a child scope.
    • global scope: (JavaScript) the root scope for a JavaScript context. Each document has a different JavaScript context, and therefore global scope.

    So let's break down what the world looks like to your code. You have 2 documents; the first contains an iframe, and the second contains a canvas. Let's call them A and B. Document A is the one that contains the iframe, and document B has been loaded into the iframe.

    You have the following code in document B

    function mynestedfunction () {
    	alert('Works!');
    }
    

    which has declared a variable in the global scope of document B, and placed a function into that variable.

    Document A has a piece of code that wants to get that function from document B and call it. First it needs to get hold of a reference to the iframe, by searching it's document for the iframe.

    // get a list of all the iframes in my document, then take the first one and place it into a variable
    var iframe = document.getElementsByTagName("iframe")[0];
    

    Now that we have the iframe we want to get the global scope of document B, which is available in the contentWindow property of the iframe, and then get the variable from it.

    // get the "Window" of the iframe, this is the global scope of it's document
    var iframe_scope = iframe.contentWindow;
    // get the function by it's name from scope
    var iframe_scope_function = iframe_scope.mynestedfunction;
    // call the function
    iframe_scope_function()
    

    There's a few interesting things to note here. Firstly if you aren't in a nested scope, any variables you declare will be in the global scope. Secondly the global scope is special in that it's contents can be read from the variable "window", you cannot do this with normal scopes. Thirdly window is declared in the global scope, so you can do silly things like window.window.window === window. Finally there is an alias to the window object called "globalThis", the reasons for using this are kinda complicated, but all you need to care is that it will give you the same value as "window".

  • I'm guessing your asking for Construct 3? Sometimes we get people asking questions about Construct 2 on the Construct 3 forums.

    .capx is the format for Construct 2 projects. Construct 3 uses .c3p instead. C3 is capable of reading .capx projects for backwards compatibility but it isn't possible to save as a .capx with C3.

    There is a guide on saving files with C3 here.

  • It's technically possible, but a lot of work. We would need to research the Android APIs further, look into similar iOS ones. Once that is done we would have to write a new cordova plugin to access the native methods, then either integrate it with an existing C3 plugin or add a new one.

    If there was more interest we would look into it, but I don't think there is. I talked to one guy a couple years back who wanted to make a game for the visually impaired using vibration but that was the last time I remember someone mentioning it.

    You can file a feature request on https://construct3.ideas.aha.io/ideas?project=C3 and we'll take a look at it once it has gained sufficient interest. Or try asking around of the SDK forum, might be that a developer will make a 3rd party plugin for you.

  • Are you using the test advert unit ID's or are you using your own with test mode enabled? We generally suggest to do the latter, as the test unit ID's can give false positives about your your configuration being correct. Test mode actually verifies your unit ID's.

    No idea what the 200 partners thing is about. Might be a side effect of using test ID's or that of the 900 providers only 200 are partners they share data with.