mrtumbles's Recent Forum Activity

  • 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!

  • 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?

  • I don't know about a plugin, but it's easy enough to do by just checking for overlaps. Do you want your objects to shuffle left, right, up, down, or just towards the centre? Either way, use detect overlap at offset in the direction you want everything to move. If it doesn't overlap another object, move it. Shouldn't be more than a line or two - I've used this for simple inventory management stuff before - provided you're not doing it on thousands of objects at once in tiny increments you should be alright.

  • That 0 by where the cursor is in your screenshot has quote marks around it, but not & symbols which would cause it to be read as a string.

  • Do you mean you want to set the tilemap's tilesheet image from any other image? If you have the URL of that image (ie: if it's a project file, or a file hosted and accessible from elsewhere) you can use the 'Load image from URL' action on the Tilemap.

    Do you mean you want to be able to import an image at runtime and draw the tile with one pixel per tile? In which case you need to load the image into a sprite, draw the sprite at [0,0], then run a 2D loop that will check every cell in your array. For example:

    For "x" from 0 to ( Tilemap.Width / Tilemap.Tilewidth )
    For "y" from 0 to ( Tilemap.Width / Tilemap.Tilewidth )
    [/code:2rszhbpz]
    
    Gives you a loop which iterates over every cell in the tilemap. You'll need a way of indexing the tiles to pixel colours, but the pixel colour can be determined using this lovely line from @R0J0hound:
    
    [code:2rszhbpz]
    Browser.ExecJS("var canvas=document.getElementById('c2canvas');
    var ctx=canvas.getContext('2d');
    var pixel=ctx.getImageData("&loopindex( "x" )&","&loopindex( "y" )&",1,1);
    pixel.data[0];")[/code:2rszhbpz]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just to holler back; the above example from korbaach is exactly what was necessary to allow me to style my sliders (and anything else in the page that was being a bit awkward) without using plugins. Several testing phases (so a good few hundred runs) in and it still hasn't once failed to correctly style my widgets. Very happy.

    Many moons of happiness upon korbaach

  • you can write this function in Browser: Execute Javascript

    not best way..but anyway... just for fun..

    Browser_Import_CSS.capx

    Just what I was looking for! I'll get down to it now...

  • You see, this is my first project and I don't remember why, but I've set the window size to 5750, 3250 when created the project. Also, one of my layouts is 31546, 3250.. And there's no way I can change that now..

    Is this the source of this big data size?

    Almost definitely. If your assets are also very big (which is quite likely given the screen size etc) then their images will be very large in terms of MB.

  • The first relies heavily on extensive use of plugins (which is incompatible with the goals of this project), the second doesn't work for slider-bars Thanks though! I've managed to get the rail to style using "webkit-appearance: none" but that's all so far.

  • Hey all! I'm working on an editor for game content, and have managed to make a nice-looking UI using the in-built form elements, styled with CSS - but I can't get sliders to style at all! They respond to css in weird ways, for example, changing the border-radius seems to simply extend and slightly the rail of the slider.

    Anyone had any success styling their sliders with CSS?

  • My only grumble here is that the freeze happens so often when the marquee tool isn't selected - but I have now at least learnt that the marquee tool pretty much guarantees it. Thanks guys

mrtumbles's avatar

mrtumbles

Member since 1 Jan, 2013

Twitter
mrtumbles has 8 followers

Connect with mrtumbles

Trophy Case

  • 11-Year Club
  • x5
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Email Verified

Progress

14/44
How to earn trophies