brazilianjoe's Recent Forum Activity

  • Oh, I see.

    Being a programmer for some time, I should have thought of that - it just didn't occur to me, as I am used to implicit type coercion.

    Is it because of web workers or strict mode that it broke?

  • I am posting here per your request, also because the project is very early.

    But I would prefer to send the link as a PM if possible, but clicking on your name I couldn't find a way to send private messages.

    Paying customers (me) have a way to report bugs?

    Direct link:

    1drv.ms/u/s!ArcXERob0wJkg7AbFnjUMcG4EsZxqg

  • For the record:

    I have an Object which is a textbox, that is called jsTxt in the objects panel.

    Layout is designed with exactly one of this Object as part of the layout.

    I have used the call javascript action and the myFubar() function is triggered correctly, posts "fubar" to the console. This errors follows immediately:

    Uncaught (in promise) TypeError: this._bbstr.includes is not a function at new C3.BBString (bbstring.js:1) at C3.Gfx.WebGLText._MaybeWrapText (text.js:1) at C3.Gfx.WebGLText._DoUpdate (text.js:1) at C3.Gfx.WebGLText._MaybeUpdate (text.js:1) at C3.Gfx.WebGLText.GetTexture (text.js:1) at C3.Plugins.Text.Instance.Draw (instance.js:1) at C3.Instance.Draw (instance.js:1) at C3.Layer._DrawInstance (layer.js:1) at C3.Layer._DrawInstances (layer.js:1) at C3.Layer.Draw (layer.js:1)

  • Hi,

    I am trying to get my first Construct JS scripting off the ground.

    Using the default built-in script, I can easily define global vars, incrementally update every tick, and also manipulate global vars created by the visual code.

    however, I tried to get an object instance and change its text, but it breaks the runtime (game freezes when I press play):

    // Put any global functions etc. here
    var touches = 0;
    var tickcount = 0;
    var jsTxto;
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    
    });
    
    function OnBeforeProjectStart(runtime)
    {
    	// Code to run just before 'On start of layout' on
    	// the first layout. Loading has finished and initial
    	// instances are created and available to use here.
    	
    	jsTxto = runtime.objects.jsTxt.getFirstInstance();
    	runtime.addEventListener("tick", () => Tick(runtime));
    }
    
    function Tick(runtime)
    {
    	// Code to run every tick
    	tickcount += 1;
    	runtime.globalVars.globaltick = tickcount;
    	jsTxto.text = tickcount; // <- this breaks it
    	//console.log("tick: " + tickcount);
    }
    
    
    function myFubar()
    {
    	console.log("fubar");
    }

    I am most certainly doing something wrong, however I can't figure out what.

    Can anyone help? Thanks!

  • Hi,

    I want, as a part of my game mechanic, to have the player draw lines vertically or horizontally. I want to record those line segments as 4 values (x1, y1, x2, y2) in an bidimensional array (4 x 1000 x 1).

    Then easily push/pop those segments and compare them for the in-game mechanics. The documentation only mentions pushing and popping in one dimension and working in one array item at a time, which does not quite cut it. Can I do it with the visual code?

  • Hi,

    I want to make a painting mechanic where the player would have to paint a canvas with color, but no enemy can collide on its path until the paint "dries".

    I am thinking if I can use the Canvas polyline for that. Is there a way to use conditions to compare the Canvas polyline to a a Sprite collision poly?

  • To answer my own question, in my project I had another solution to a previous problem (how to preserve constant linear speed after every collision bounce), that was made for a single object (boss). that used a single variable to store the angle. when increasing the number of objects, when rectifying the speed, it also changed the direction of all objects to a single one.

    I changed that part to work inside the For Each loop to account for multiple objects, and now it's working.

  • So, I am getting started with the platform, and I want to settle in a good model to update the game state.

    I can do 'every 0.016 seconds' for a theoretical 60 game state updates per second.

    Or I can to 'every tick' - which I don't know how to set the tick rate.

    I can also use dt to track how much time has passed since the last game update, but I suspect it is tied to tick rate, so I don't know if it would interact well with 'every X seconds'.

    Both tick rate and 'every X seconds' are a best-effort, that is limited to processing capacity of course, so the game will slow down if there is too much going on.

    Are there clear downsides on using 'every X seconds' over 'every tick'?

    Can I set a fixed tick rate, or cap it at e.g. 60 hertz?

    I would like to have game logic to run at a fixed rate independent of frame rate, even if frame rate slows down. Would it be a good model to use 'every X seconds' to update data, and use 'every tick'to update the screen?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    Continuing in my mission for a simple game:

    I have one Sprite that bounces off walls using Physics.

    On Touch, I can repel the object away from the touch point.

    Upon creating a second instance of the Sprite (just dragged it from the Project into the Layout), I thought that the Touch action would scatter each instance in a different angle, away from the touch point.

    What I see though, is that all instances of the object go to a single direction in parallel.

    How can I achieve the desired object scatter in different directions, using the same Sprite instanced multiple times?

    Can I do it with visual scripting alone, or I will have to break into javascript?

  • Rephrasing:

    I want to On Touch, For Each instance object of Sprite boss, to push it radially from the Touch tap coords.

    I already have an Event:

    On Touch For Each boss on boss: apply Physics impulse 1 at angle angle(Touch.X, Touch.Y, boss.X, boss.Y)

    My latest guess is that this is not the way , because the on boss might be picking only the first instance to calculate the angle (boss.X, boss.Y), but I can't figure out how to pick the chosen instance inside the loop.

  • The thing is, I don't want a random scatter, I want the angle to be a push originating from the Touch position outwards.

    I don't think random() would help that, am I right?

    I have a Touch event, which gives me Touch.X and Touch.Y, and 2 instances of the same object, each on a distinct X and Y position.

    I tried to calculate:

    On Touch event: Apply Physics impulse 1 at angle: angle(Touch.X, Touch.Y, boss.X, boss.Y)

    But it does not consider the 2 instances of the boss Sprite independent X and Y coordinates, which is what I am aiming for.

    Please advise.

brazilianjoe's avatar

brazilianjoe

Member since 14 Jan, 2020

None one is following brazilianjoe yet!

Trophy Case

  • 4-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies