mrtumbles's Forum Posts

  • What was the solve?

  • My gosh. Did not realise we can colour-code groups or comments. But honestly that only makes a greater argument in my mind for colour-coding events, for continuity's sake.

  • Assigning a colour label to events would make visual classification much easier, improve the user experience, allow for easier matching between tutorials and their CapXs, and stop me having to hunt so hard for all those diagnostic events I buried deep in the fourth nested loop of my Convchain.

  • One way to go about this that has worked for me in the past is to start by building a tool with which to mod your game - and work from there outwards. You can continue to grow the tool as the game develops, and have it output files which can be read at a later date. Good luck! Making tools is fun.

  • Loading the image should be straightforward - using the Sprite>Load image from URL action.

    Retrieving the image for output might be harder - you might want to look at the Paster plugin:

  • It's that ( 1+dt ) bit that's the problem. Delta-time needs to be directly related to the number you're using. Try something like ( 60 * dt ) instead. So long as it's multiplying by dt, you'll want to fidget with that 60.

  • What makes you feel this way?

  • I think you're probably gonna have to post a capx

  • Set object position to:

    clamp( Self.X, ViewportLeft( Self.LayerName ), ViewportRight( Self.LayerName ) )

    clamp( Self.Y, ViewportTop( Self.LayerName ), ViewportBottom( Self.LayerName ) )

  • dop2000 is correct when he says it's probably better to handle the bullet with one object rather than three, presuming the bullets all behave the same otherwise. I like the idea by the way, only allowing the player to shoot matching enemies, that's cool.

    If you need to do this still (ie, bullets of different colours behave very differently and can't be handled using a single object) you can do it using a variable on the player. Make it a text variable, and whenever the player fires a weapon (or on the start of the layout) you fire the currently indicated colour of bullet, then set the variable to:

    choose( "red", "blue", "yellow" )[/code:3q68yvx4]
  • I would definitely try and make it so that the player was represented by the same sprite object everywhere they're present. You're lining yourself up for a headache.

  • Just recently I've started using tiny little bits of javascript through the Browser.ExecJS expression. It's neat, and has solved a few problems that vanilla C2 just can't. I'm learning more about javascript now (most of what I've gotten has been cribbed from other sites/this forum), but would anyone like to share any of their favourite ExecJS snippets? Here are mine

    This one gets the start and end caret position of a textbox/area with the CSS ID 'text':

    {var ctl = document.getElementById('text');
        var startPos = ctl.selectionStart;
        var endPos = ctl.selectionEnd;
        startPos + "","" + endPos;}[/code:3w47tz8o]
    
    This one imports a stylesheet.css from project files to apply to the layout:
    [code:3w47tz8o]function  myFunction(filename, filetype){
            var fileref=document.createElement('link')
            fileref.setAttribute('rel', 'stylesheet')
            fileref.setAttribute('type', 'text/css')
            fileref.setAttribute('href', filename)
            document.getElementsByTagName('head')[0].appendChild(fileref)};
     myFunction('stylesheet.css', 'css');[/code:3w47tz8o]
    
    And this one makes it so that the two textareas named 'code' and 'lines' scroll together:
    [code:3w47tz8o]$('#code').scroll(function(){$('#lines')[0].scrollTop = $('#code')[0].scrollTop;});[/code:3w47tz8o]
  • Can't view your capx as I'm on mobile - but I would add two global variables to store your position. Call them something like 'ReturnToX' and 'ReturnToY'. Before switching layouts, set the global variables to the player's X and Y. After switching back, set the player's X and Y to the contents of the variables. This will allow you to always recall the player to their position before the last transition *only*.

    To recall more than one transition, you might want to add a Dictionary object. When the player leaves a layout, add a key to the dictionary named Player.LayerName, with the value Player.X&","&Player.Y. When the player enters a layout, set their X to int( tokenat( Dictionary.Get( Player.LayerName ), 0, "," ) ) and their Y to int( tokenat( Dictionary.Get( Player.LayerName ), 1, "," ) ) . This will continually track the player's last location in as many layouts as you have, so long as all layouts have the necessary events. The Dictionary is a global object, so its contents are always available to all event sheets.

  • Self-solved! First bit of javascript I sorted out for myself...

    Browser.ExecJS

    ( "{ var ctl = document.getElementById('code');

    var startPos = ctl.selectionStart;

    var endPos = ctl.selectionEnd;

    startPos + "","" + endPos; }" )

    Where "code" is the ID of the textarea, in my case... note the double ""s!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want to add a quick reference system to my procedural generator scripting engine. Functions in the script are called line-by-line, so if I can determine the cursor's position in the scripting textarea, I can provide accurate and relevant tooltips etc. I know the javascript properties selectionStart and selectionEnd can be used to retrieve this - but I've had no luck. Any ideas?