Jump to content

Feature requests


enpu
 Share

Recommended Posts

I don't know if this is implemented or not (haven't looked through the docs fully), but I would like to the engine to load only the assets needed for the current (or soon to be) scene.

 

Maybe a property to set whether this behavior is turned on or off. If its on, its possible to set a fade in/out time of the current scene, to fade into the loader, load the assets, then fade into the new scene. The fade time (and color?) could either be instant or a set time.

Link to comment
Share on other sites

I have a suggestion

 

Instead of repeating all the images path like this:

// Load imagesgame.addAsset('images/image1.png');  game.addAsset('images/image2.png');  game.addAsset('images/image3.png');  SceneGame = game.Scene.extend({      init: function() {        var sprite = new game.Sprite(100, 100, "images/image1.png");        sprite = new game.MovieClip([              game.Texture.fromImage('images/image1.png'),              game.Texture.fromImage('images/image2.png'),              game.Texture.fromImage('images/image3.png')        ]);         // etc...    }  });

 

It would be nice if the addAsset() function would also return the path so we could store for future uses. That way if we need to change the assets path or filename, we don't need to change everywhere in the code.

 

Something like this would be nice:

// Load imagesvar img1 = game.addAsset('images/image1.png');  var img2 = game.addAsset('images/image2.png');  var img3 = game.addAsset('images/image3.png');  SceneGame = game.Scene.extend({      init: function() {        var sprite = new game.Sprite(100, 100, img1);        sprite = new game.MovieClip([              game.Texture.fromImage(img1),              game.Texture.fromImage(img2),              game.Texture.fromImage(img3)        ]);         // etc...    }  });

[edit] I like gregmax17's even more (see below)

Link to comment
Share on other sites

Absolutely!

 

I was thinking about to replace tween module with this one:

https://github.com/sole/tween.js/

 

What do you think?

 

I was using sole's Tween until I found that tweens are not synced and there's no grouping. Look at https://github.com/sole/tween.js/pull/88

 

The suggested mod kinda works, but for some reasons I get out of sync animations anyway on the long run.

Link to comment
Share on other sites

This is probably the best demo to test syncing

 

game.module(    'game.scenes').require(    'engine.scene').body(function() {SceneGame = game.Scene.extend({    backgroundColor: 0x808080,    init: function() {        var sprite, tween;        // Sprite 1        sprite = new game.Sprite(0, game.system.height / 2, 'media/logo.png', {            anchor: {x: 0.5, y: 0.5}        });        tween = new game.Tween(sprite.position)            .to({y: 0}, 500)            .repeat(Infinity)            .yoyo(true)            .start();        this.stage.addChild(sprite);        // Sprite 2        sprite = new game.Sprite(game.system.width, game.system.height / 2, 'media/logo.png', {            anchor: {x: 0.5, y: 0.5}        });        tween = new game.Tween(sprite.position)            .to({y: 0}, 500)            .repeat(Infinity)            .yoyo(true)            .delay(200)            .start();        tween.delay(0);        this.stage.addChild(sprite);        // Sprite 3        sprite = new game.Sprite(game.system.width / 2, game.system.height / 2, 'media/logo.png', {            anchor: {x: 0.5, y: 0.5}        });        tween = new game.Tween(sprite.position)            .to({y: 0}, 500)            .repeat(Infinity)            .yoyo(true)            .delay(100)            .start();        tween.delay(0);        this.stage.addChild(sprite);    }});});

Everything seems to work as expected (except for a very bad tearing... I've never seen it so pronounced, but maybe I just have too many chrome tabs opened :) )

 

As long as you keep tween grouping like before, I'm in for the new system :) The problem would be to keep up with the main repo updates maybe.

Link to comment
Share on other sites

sprite = new game.Sprite(game.system.width / 2, game.system.height / 2, 'media/logo.png', {    anchor: {x: 0.5, y: 0.5}});tween = new game.Tween(sprite.position)    .to({y: 0}, 500)    .repeat(Infinity)    .yoyo(true)    .delay(100)    .start();tween.delay(0);this.stage.addChild(sprite);

I don't understand, why do you set delay twice there?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...