DiegoM's Forum Posts

  • After the tween starts, t.value will have the value the tween is currently in.

    In order to get the changing value over time you need to query that function multiple times during the lifetime of the tween. You can do that by listening for the "tick" event of the runtime.

    Try adding something like this to your main script.

    let t = null;
    
    async function OnBeforeProjectStart(runtime)
    {
    	// Set up a "tick" event listener
    	runtime.addEventListener("tick", () => Tick(runtime));
    	
    	// Get the first Sprite instance
    	// (assumes a Sprite instance already exists in the layout)
    	const sprite = runtime.objects.Sprite.getAllInstances()[0];
    	
    	// Get the Tween behaviour from the sprite
    	// (assumes the Tween behaviour has been added to the instance in the editor)
    	const tween = sprite.behaviors.Tween;
    	
    	// Start the tween
    	t = tween.startTween("value", 200, 3, "linear", {
    		startValue: 100
    	});
    }
    
    function Tick(runtime)
    {	
    	// Check every tick for the state of the tween,
    	// Make sure it has been created and that is hasn't been released before trying to use it
    	if (t)
    	{
    		if (t.isReleased)
    		{
    			// Null the reference to the tween once it has been completed
    			t = null;
    		}
    		else
    		{
    			// Get the value of the tween
    			console.log(t.value);
    		}	
    	}
    }
    

    You can check what is being printed in the console by pressing F12 when the preview window shows up.

  • This is a small example showing how to load an animated SVG.

    dropbox.com/s/w66ch2oks77qzl1/Animated%20CSS.c3p

    The SVG is in it's own file and is loaded into the HTML element using the AJAX plugin. The animation is defined in a separate CSS file which is loaded automatically by setting it's purpose to "Stylesheet"

    I haven't tried it, but you could also choose to define the SVG and CSS directly in the Content property of the HTML element instance.

  • Yeah, that's it. That's the main thing the timer behaviour does under the hood.

  • I think the only non obvious thing you should take into account if you are just going to use a variable as a timer is delta time (There is a system expression to get the current delta time).

    If you just use a value by which the variable is incremented you could end up with the timer taking more or less time to complete on different devices running at different frame rates.

    Depending on your use case that might not be an issue though. For example the case of just wanting to produce extremely short delays, as in a few frames.

    I'm going to lock this thread now because the original problem has already been understood and for some reason people are using this thread to post their unrelated problems in.

    If anyone is having any issues please file a bug report following the guidelines, that is the best way to get help.

  • The fastest way to get help is to share your project, most likely there is a small, non obvious detail that you are missing.

    Sometime because we look at our projects all the time and already have a way in which we go about solving problems it can be easy to miss stuff that is falling out of our common think patterns.

    Someone else is likely to find this issues a lot quicker because they think different.

  • In 2D the only way to solve this is by having two different sets of animations for each side, no hidden tricks.

    Granted, most games (including high profile ones) don't even bother with it and just mirror the images.

    The most common example of this is 2D fighting games, at all levels of development, from the tiniest of studios to big budget AAA games, the graphics are just flipped and nobody seems to be bothered with it. Some of the newer fighting games that could easily do it because they are in 3D, still choose to flip the assets because it is more convenient for the players to see the same graphics no matter what side the character is facing.

    If you still want to do it, you will need to produce more graphics.

  • I didn't think about the possibility of loading the page in an iframe, but you will have a similar problem, if the page you want to show doesn't like being shown in a different origin, then it won't work.

  • An easy way to find out the requests a page is doing is by opening dev tools in your browser, usually by pressing F12, and then going into the network tab.

    You will see everything the page is doing, which usually is a lot more than you would think! It might take a while to go through everything but you will surely find it there.

    If you are lucky you will be able to hit the endpoint yourself, unless it is somehow protected by either some sort of pass key or maybe a cross origin access policy.

  • Just to clarify, headless browsers are libraries that let you write programs that behave like a normal internet browser. There should be at least one headless browser for the most popular server side languages, such as JavaScript (node.js) or Python.

    They have functionality such as waiting for a page to execute JavaScript after the initial request, before trying to query the content of a page, among other things.

    For the most part they are used for website testing, but they can have other uses like web scraping.

  • From your description I take that you are trying to do some web scraping and your problem is that the page you are trying to scrape has dynamically generated content which doesn't exist upon requesting a page, is that right?

    As far as I am aware this is not possible directly from a browser using AJAX, either through C3's plugin or directly through Javascript using an XMLHttpRequest.

    Don't think you will be able to do this directly from a C3 application.

    Any website that is providing such a service is first making a request to a remote server, then the server uses what is known as a headless browser to navigate to the required website, scrape the data it needs, and finally returns the result to the client.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When an instances is added as a child it keeps the relative position it had to the parent before being added. This means that although there is no built in method to add a child to a hierarchy at an image point, you can achieve the same effect by positioning an instance according to an image point and then adding it to the hierarchy using the Add Child action.

    As for Rope Style and Bar Style, I don't think those will be added into hierarchies, simply because they are very specific functionality and hierarchies are more a of a general purpose system.

    I doubt the pin behaviour will ever be deprecated because there are already tons of existing projects that use it, so we are pretty much forced to keep it around for backwards compatibility.

  • gluii

    Try this:

    1) Set a boolean variable to "true" indicating when a building has been entered. This can be a global if you only have one building or if you have many buildings try with an instance variable for each one.

    2) Set up a condition checking for the value of that variable, if it is "true" then do what ever needs to be done to show the inside of a building. If it is "false" then you do what needs to be done to show the outside of the building.

    3) Set up a condition block to set the variable back to "false". This one should only work, when you are on top of the door AND you press the appropriate keys (maybe the up arrow?) AND the variable itself has a value of "true". That way you can be absolutely sure it will only be turned to "false" at the right time.

    What ever you choose to do, you might run into the problem of entering and exiting very quickly out of the building as long as your character is on top of the door. So you might need some additional conditions to make sure that the actions to enter/exit the building are not executed in rapid succession.

    Hope that helps.

  • At the moment the brush editor is only meant to setup auto tiling brushes. You can't rotate tiles.

    Never thought about rotating tiles in the brush editor, I guess it would make it slightly more flexible. In the mean time the tileset should contain all the variations for each tile.

  • The tag you can give when you play a timeline is used to identify it later on with the the pause/resume and stop actions, as well as with the "on complete" trigger conditions that accept a tag.

    The tag you can give to keyframes is used for the keyframe reached trigger condition that accepts a tag, so you can do something when a specific keyframe is reached.

    They are not related.

    Can you explain how you were expecting the tagging to work?