Ashley's Forum Posts

  • It could be number based, but then what do you do when two objects, or even 20 objects, have the same number?

    I thought layers were the best way to Z order things to their approximate location (background, mainground, foreground etc.), so that Z order within a layer isn't so important, so things like 'send to front/back' are sufficient. What are you trying to do that needs such fine control?

    Incidentally 0.x supports Z ordering by number as well - use an ordered for-each over a private variable to send each instance to back, and they'll end up Z ordered by the private variable.

  • 1. Is better for performance to use a TiledBackground instead of filling the field with Sprites?!?

    Never have a grid of sprites! It's very slow. You should use a Tiled Background with a texture that is a power-of-two size (e.g. 32x32, 64x64, 128x128...). Tiled backgrounds at that size can draw as efficiently as a single sprite, no matter how big they are!

  • You still haven't fixed hog2 - it's not a fair test at all because it's much smaller than hog1, so only a fraction of the canvas needs to be rendered, so there's much less work to do.

  • In 2) the width and height attributes are missing from the canvas tag in the HTML, so it reverts to browser default (300x200 IIRC). 1) has the attributes present so displays correctly.

    If you want to measure speed, you should also throw in a text object and set it to fps every tick - then you can see the fps instead of trying to tell which looks smoother!

    I'd also be interested to see if there's any difference on iOS 5 - apparently the canvas has been sped up a bit in that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As before, a new dev poll for what you need most next. We're still prioritising the image editor and animations which should come soon, so it's not in the poll. Fine collisions will be based on features in the image editor, so that too will have to wait. In the mean time though, which features are you missing the most?

  • Oops, I broke solid in the refactor. Attached is a fixed runtime.js, paste it in to exporters\html5\behaviors\solid to fix.

  • I found out some more about how to get AJAX requests working. I've edited the OP with more info.

  • Download Construct 2 public preview 39

    Link to release 38.2

    Three new plugins and a few bug fixes this build. The new plugins are Ajax, Array and Browser. See the changelog for more!

    Edit 08/06/11: Some updated info on the AJAX plugin: Modern browsers prevent cross-domain requests for security reasons. This means a page on scirra.com can only request other pages on scirra.com. Another difficulty is files on disk count as a different domain too. Construct 2 previews your game from files on disk. Therefore, requesting any page from the internet will fail in preview mode, because going from disk to the internet is cross-domain too.

    However, servers can be set to respond to cross-domain requests. This is generally only done for things like data services, but if the server sends this HTTP header:

    Access-Control-Allow-Origin: *

    then the page can be requested from any domain - other servers, or files on disk. That means it works in preview too! For example, if you are requesting your own PHP file from your own server, you can add this line to the PHP script:

    header("Access-Control-Allow-Origin: *");[/code:3oe4d6vi]
    
    This will make requests work when previewing.  This makes testing it a lot easier.
    
    The only other alternative is to export the project and upload it to your server to test the AJAX requests.  That's kind of slow, so if you can get it to send out that header, that will make life easier for you.
    
    Remember you still can't make cross-domain requests by default, even when the script is online, unless the server you are requesting also sends out an Access-Control-Allow-Origin header that allows your domain.  You might be able to contact the person running the server and have them modify it so your application works, but this is only likely to work if you know them or work with them.
    
    Hopefully that will help you make the most of the AJAX plugin.  Please remember these limitations aren't Construct's fault - the internet is designed like that for security reasons, so we have to work with that.
    
    [h2]Changelog[/h2]
    [ul]
    	[li][Add] Browser plugin: can navigate to pages, get browser details, etc.[/li]
    	[li][Add] AJAX plugin: request URLs dynamically as the game runs.  However, cross-domain requests are limited, and requests in preview may fail.  See caveats above.[/li]
    	[li][Add] Array plugin: like with Classic, store arrays of values in up to three dimensions.[/li]
    	[li][Add] 'Edit texture' context menu option when right clicking objects with textures in a layout.[/li]
    	[li][Change] Upgraded bundled jQuery version from 1.4.4 to 1.6.1[/li]
    	[li][Fix] False-positive assert failure ("system_expression != NULL").[/li]
    	[li][Fix] Multiple spaces in expressions were collapsed to a single space when saved and loaded, due to an incorrect XML parser setting.[/li]
    	[li][Fix] Layer 'initially visible' setting was mixed up with the 'visible in editor' setting when loading a project.[/li]
    	[li][SDK] Runtime scripts have been refactored to be simpler and minify better.  It should be a bit easier to write plugins and behaviors now, and minified runtime scripts are a few kb smaller.[/li]
    [/ul]
  • If you only want to save VRAM, it would be better to simply add proper non-power-of-two texture support to Classic, like C2 already has with OpenGL. I can't remember if DirectX 9 supports it though. With non-power-of-two support, images take up exactly their size in VRAM, no more, no less, nothing to be saved by slicing up.

  • I thought the point was the convenience of having the objects grouped together rather than to save VRAM?

  • You can define nine cells of the panel object, but I realise that's more for stretching and UI. I guess you want a sort of "composite object", which is made out of other objects but acts like one?

  • You do not have permission to view this post

  • Have you seen the Panel object? Is that what you mean?

  • You do not have permission to view this post

  • C2 doesn't yet support arrays, so you can't return more than one value from an expression. You should use different expressions, or a parameter (like the Array object takes an index parameter in Classic).