R0J0hound's Recent Forum Activity

  • It's like "1" in many programming languages.

    c/c++/java/javascript/...

    if(condition)
    {
    	//actions
    }
    else
    {
    	// actions
    }

    Even in indented languages like python it's like that. I guess it would be more like "2" in languages in lisp or something.

    Anyways, events are a lot like typed languages. For example some normal events would look like this in javascript or something like that:

    // trigger events
    function startOfLayout()
    {
    	action();
    }
    
    // game loop
    while(1)
    {
    	//all non triggered events
    	// normal two condition event
    	if( condition1 and condition2)
    	{
    		action();
    	}
    	else
    	{
    		//repeat 10 times
    		for(var loopindex=0; loopindex<10; ++loopindex)
    		{
    			action();
    		}
    	}
    
    	draw_frame();
    }

    The only added complexity is when you're doing stuff with picking.

  • Would this work? It sets a variable with the amount it wants to rotate, and as it rotates it reduces that number. Used an additional variable to keep from overshooting.

    global number toRotate = 0
    global number da=0
    
    on any key pressed
    toRotate = 0
    -- add 90 to toRotate
    
    toRotate > 0
    -- set da to min(100*dt, toRotate)
    -- sprite: rotate da degrees clockwise
    -- subtract da from toRotate

    Another idea is to lerp from one angle to another:

    global number startAngle = 0
    global number endAngle = 0
    global number t = 1
    
    on any key pressed
    t = 0
    -- set startAngle to sprite.angle
    -- set endAngle to startAngle+90
    -- set t to 0
    
    t<0
    -- set t to min(t + 10*dt, 1)
    -- sprite: set angle to lerp(startAngle, endAngle, t)

    There may be easing plugins to help with that too.

  • I need the following colours:
    R 255
    G 225
    B 0
    
    fading into
    R 255
    G 0
    B 255

    global number t = 0

    t<0

    --- set t to min(t+dt/2, 1)

    every tick

    --- set background color rgb(lerp(255,255,t), lerp(255,0,t), lerp(0,255,t))

    In the "t<0" event you can change the 2 to how many seconds the transition will take.

  • Have you seen the ask manual?

    construct.net/en

    It has more details about most of that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I’d imagine there are no downsides. It’s just a form control so it’s simple enough to do. In the history of scirra though, they usually defer to third party plugins instead of making it themselves. No idea if they’d want to add it though. It’s usually easier and faster to implement it myself with js. That’s completely against the no programming required mantra, but it gets me going with something before I lose interest.

  • Thanks!

    I added a cheap perspective ability to the 3d rotate capx as a test. Ended up working decently.

  • Decided to have a go at it and it came out fairly simple. Well, it does touch on many different concepts. The language I came up with has an assembly/zzt feel to it.

    construct.net/en/forum/construct-2/your-construct-2-creations-23/more-rojo-tests-138761

  • Pandy

    I got carried away with some ideas and I posted an example here:

    construct.net/en/forum/construct-2/your-construct-2-creations-23/more-rojo-tests-138761

    Came out pretty clean. The idea is you generate the cube image any way you want, then only once per frame load an animation frame.

  • I'm going to start posting miscellaneous capx projects I have here from time to time.

    Here is simple way to rotate a bunch of 3d points. It also utilizes the paster object to generate a cube image.

    uc61e28ffd9c45105984477e2c56.dl.dropboxusercontent.com/cd/0/get/Ch7rT_NL_0FqXMHC1vulSlB-BF-yPKtR1eN1ktaw8kPXvF3cH0di5irbTjbeL9BbP5_ygK6QPvma2pa1N4K8VGk-QT8ow5mDS_cVAMBYyQu2CKDxTHc3q73rwery2wu8yik/file

    This is a simple programming language and interpreter test. It has boolean variables, if's and goto. Kind of has an assembly like feel to it. I kind of fudged on error checking but it works well.

    uc7ae2c071507add2db940bad361.dl.dropboxusercontent.com/cd/0/get/Ch5hooeOySCwsf8DRBQc1Ljd9r8C9kiCGFNLBBZjGE0vVCxwQYB_xpJwB7wVSnFRDAieF4jYuaqoKcK1fYkORm4yf8Zm0PT8tiT17RAilCv5l6nnwPVDgpK7Idlr0_tpfN4/file

    Example script that moves from wall to wall:

    forward
    if angry forward
    ifnot wall goto end
    log ouch
    set angry
    right
    right
    :end
  • I have a discord I haven’t used in ages. I probably should install it again.

    Edit:

    My discord name is reddog

    Had a look in your capx. Didn’t have “Rex function” or “polygon” installed so I removed them. Looks like one wasn’t used and the other, polygon was just another option from paster.

    I will say the polygon plugin is probably your biggest bottleneck. It has the same issue the canvas plugin had. It draws to a hidden canvas first and is copied to a webgl texture. This is slow and uses a lot of memory when drawing many polygons.

    I noticed you’re using some JavaScript. I usually define the functions once in a start of layout. To make the functions accessible later you’d define them as

    window.myfunction = function(){};

    Instead of

    var myfunction = function(){};

    Or

    function myfunction(){}

    And the beauty of it is you’d still be able to call the function as myfunction().

    Window is the global object.

    You can do it with just events as well. Might look more readable.

    One thing I do to make my expressions more readable is to avoid using tokenat or even array.at as much. Probably just a personal preference.

    For max performance you could do almost everything in JavaScript and only do minimal stuff in events like add cubes, set the view rotation, and request it to be drawn. Kind of loses the fun of using construct though if you run into js errors.

  • Last I looked you can get at the runtime parts of the plugins when you are previewing. Open up the browser’s debugger and in the source code section there is a list of js files. Some of them are the runtimes of the plugins. It was that way when I looked last at least, which was around when c3 first came out.

    Edittime is inaccessible as I recall. It’s all minified.

  • I don’t know about that, but if he has a particular language he wanted to make in mind, things can be simpler/easier.

    Simplest would to not do a parser at all and just add a list of commands to an array, loop over the array and depending on the command do something. Of course you can get a lot more deluxe.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound