Sign in to follow this  
enpu

Panda 2 Tips & tricks

Recommended Posts

Want to set your game window to specific size? This is great for testing your game on different resolutions and for taking screenshots.

First detach the game window to it's own window by pressing the detach button.

5a5b89145c758_ScreenShot2018-01-14at18_43_17.png.09c22e4a8a66d80f984b0c3494f0e130.png

Then click the detach button again while pressing Shift-key down. Popup window will appear, type the size you want into the window, for example "320x480":

5a5b893fec809_ScreenShot2018-01-14at18_43_43.png.8acc42b828774f6e7231ab1d222176de.png

This will change the game window size so that the game area itself is exactly the resolution you entered (the red area):

5a5b89eeaed66_ScreenShot2018-01-14at18_48_19.png.76384dd886e09cc91d1f5dc123b91f6c.png

Share this post


Link to post
Share on other sites

Create slowmotion effect easily by changing the speed of the main game timer. Keep in mind that this affects everything in the game (tweens, timers etc).

// 50% slowdown for 1 second

game.Timer.speed = 0.5; // This will slowdown everything to 50%

game.Timer.add(500, function() { // So this will take 1 second to complete
    game.Timer.speed = 1; // Back to normal speed
});

 

Share this post


Link to post
Share on other sites

If you have a repeating tween, but want to start it from a random time, just use this code after you have created your tween:

tween.currentTime = tween.duration.random();

For example, if a have a button that i want to swing from side to side using tween, but don't want it to always start from same position:

var button = new game.Sprite('button.png');
button.rotation = -0.1;

var tween = game.Tween.add(button, {
    rotation: 0.1
}, 1000, {
    repeat: Infinity,
    yoyo: true,
    easing: 'Quadratic.InOut'
}).start();

tween.currentTime = tween.duration.random();

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.