You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4 lines
2.3 KiB
JavaScript
4 lines
2.3 KiB
JavaScript
11 years ago
|
|
||
|
window.addEventListener("load",function(){var Q=window.Q=Quintus({development:false,imagePath:"/images/crushed/"}).include("Sprites, Scenes, Input, 2D, Anim, Touch, UI").setup({maximize:true}).controls().touch()
|
||
|
Q.Sprite.extend("Player",{init:function(p){this._super(p,{sheet:"astronaut",x:290,y:96});this.add('2d, platformerControls');this.on("hit.sprite",function(collision){if(collision.obj.isA("Rocket")){var rocket=collision.obj;rocket.add("tween");rocket.animate({x:100,y:-500,angle:360});Q.stage().unfollow();Q.stage().viewport.follow(rocket);this.destroy();$("#einladung").show("slow");}});}});Q.Sprite.extend("Rocket",{init:function(p){this._super(p,{sheet:'rocket'});}});Q.Sprite.extend("Enemy",{init:function(p,q){this._super(p,q);this.add('2d, aiBounce');this.on("bump.left,bump.right,bump.bottom",function(collision){if(collision.obj.isA("Player")){Q.stageScene("endGame",1);collision.obj.destroy();}});this.on("bump.top",function(collision){if(collision.obj.isA("Player")){this.destroy();collision.obj.p.vy=-300;}});}});Q.Enemy.extend("Neingeist",{init:function(p){this._super(p,{sheet:'neingeist',vx:100});}});Q.Enemy.extend("Starbug",{init:function(p){this._super(p,{sheet:'starbug',vx:90});}});Q.Enemy.extend("Martin",{init:function(p){this._super(p,{sheet:'martin',vx:80});}});Q.scene("level1",function(stage){stage.insert(new Q.Repeater({asset:"background.png",speedX:0.5,speedY:0.5}));stage.collisionLayer(new Q.TileLayer({tileW:24,tileH:24,dataAsset:'level.json',sheet:'tiles'}));var player=stage.insert(new Q.Player());stage.add("viewport").follow(player);stage.viewport.scale=2;stage.insert(new Q.Starbug({x:584,y:0}));stage.insert(new Q.Neingeist({x:620,y:0}));stage.insert(new Q.Martin({x:530,y:0}));stage.insert(new Q.Rocket({x:122,y:32}));});Q.scene('endGame',function(stage){var container=stage.insert(new Q.UI.Container({x:Q.width/2,y:Q.height/2,fill:"rgba(0,0,0,0.5)"}));var button=container.insert(new Q.UI.Button({x:0,y:0,asset:"nochmal.png"}))
|
||
|
button.on("click",function(){Q.clearStages();Q.stageScene('level1');});container.fit(16);});Q.load("sprites.png, sprites.json, level.json, tiles.png, background.png, nochmal.png",function(){Q.sheet("tiles","tiles.png",{tilew:24,tileh:24});Q.compileSheets("sprites.png","sprites.json");Q.stageScene("level1");$(loading).hide();});});
|