Skip to content
Snippets Groups Projects
Commit 9907788e authored by M3156's avatar M3156
Browse files

persetulivuori

parent d346f089
No related branches found
No related tags found
No related merge requests found
Pipeline #175491 passed
harkka3/samson/assets/sprites/ass.png

23.2 KiB

harkka3/samson/assets/sprites/brown-ball.png

228 B

harkka3/samson/assets/sprites/orange-ball.png

222 B

harkka3/samson/assets/sprites/platform.png

798 B

harkka3/samson/assets/sprites/platform_450x50.png

567 B

harkka3/samson/assets/sprites/red-ball.png

222 B

var i;
demo.state4 = function(){};
demo.state4.prototype = {
preload: function(){},
create: function(){
game.stage.backgroundColor = '#ffff00';
addChangeStateEventListeners();
j1 = game.add.sprite(50, 100, 'jorma');
j2 = game.add.sprite(350, 100, 'jorma');
j3 = game.add.sprite(650, 100, 'jorma');
j4 = game.add.sprite(950, 100, 'jorma');
j5 = game.add.sprite(1250, 100, 'jorma');
game.add.tween(j1).to({y: '+400'}, 2000, 'Bounce.easeOut', true);
i = game.add.tween(j2).to({x: 100, y: 0}, 1000, 'Elastic.easeOut', true);
game.add.tween(j3).from({y: 1000}, 1500, "Circ.easeOut", true);
game.add.tween(j4.anchor).to({x: 1}, 1000, 'Linear', true, 1000, false, true).loop(true);
game.add.tween(j5).to({alpha: 0}, 1000, 'Bounce', true,);
},
update: function(){}
}
\ No newline at end of file
var accel = 400, platform, platformGroup;
demo.state5 = function(){};
demo.state5.prototype = {
preload: function(){},
preload: function(){
game.load.image('platform', 'assets/sprites/platform_450x50.png');
},
create: function(){
game.stage.backgroundColor = '#009900';
addChangeStateEventListeners();
jorma = game.add.sprite(centerX, 500, 'jorma');
platform = game.add.sprite(0, 800, 'platform');
platformGroup = game.add.group();
platformGroup.create(650, 400, 'platform');
platformGroup.create(1300, 400, 'platform');
game.physics.enable([jorma, platform, platformGroup]);
jorma.body.gravity.y = 500;
jorma.body.bounce.y = 0.3;
jorma.body.drag.x = 400;
jorma.body.collideWorldBounds = true;
platform.body.immovable = true;
platformGroup.setAll('body.immovable', true);
},
update: function(){}
update: function(){
game.physics.arcade.collide(jorma, [platform, platformGroup]);
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)){
jorma.body.acceleration.x = -accel;
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)){
jorma.body.acceleration.x = accel;
}
else {
jorma.body.acceleration.x = 0;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)){
jorma.body.velocity.y = -300;
}
}
}
\ No newline at end of file
demo.state6 = function(){};
demo.state6.prototype = {
preload: function(){},
preload: function(){
game.load.image('ass', 'assets/sprites/ass.png');
game.load.image('redBall', 'assets/sprites/red-ball.png');
game.load.image('brBall', 'assets/sprites/brown-ball.png');
},
create: function(){
game.stage.backgroundColor = '#000099';
addChangeStateEventListeners();
game.add.sprite(centerX, 1000, 'ass').anchor.setTo(0.5, 1);
var emitter = game.add.emitter(centerX, 500, 2000);
emitter.makeParticles(['redBall', 'brBall'], 0, 5000, false, true);
emitter.maxParticleSpeed.set(300, -300);
emitter.minParticleSpeed.set(-300, -100);
emitter.gravity = 300;
game.time.events.add(2000, function() {
emitter.start(false, 5000, 20);
game.time.events.loop(500, function(){
if(emitter.on) {
emitter.on = false;
} else {
emitter.on = true;
}
});
});
},
update: function(){}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment