Search the Community

Showing results for tags 'html5'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 1,013 results

  1. Mission 13 - Lost in Space

    Mission 13 - Lost in Space Check out our newest game, Mission 13! We spent the last few weeks developing it for the JS13K Games competition hosted by Andrzej Mazur at Enclave Games. As most of you probably know, the idea of this competition is to fit a whole game in a zip file less than 13kb. We managed this with our entry, and here is the end result! Also, feel free to plaster it across social media, trust me, we won't mind http://js13kgames.com/entries/mission-13-lost-in-space Some technical features of this game, for all you nerds out there include: Custome image generation. (For stars, planets, and asteroids) Audio synthesizer using JSFXR. Support for both mobile and desktop with fullscreen resizing capabilities. Random terrain generation. And most importantly, love.
  2. I've dabbled in developing Flash games back in the day using frameworks like Flashpunk, but haven't done much in terms of game development in recent years. I kept developing concepts though, one of which I'd like to develop further using modern tools - but I'm completely lost in the current world of 2D game architectures. One option I'd really like to have is being able to export to console (PS4/XBone). Consequently I've tried out Unity and Game Maker Studio (I've bought a 1.4 version license some time ago). Both seem very cumbersome to me and I'm struggling to get a decent workflow established. I've liked ActionScript based frameworks like Flashpunk for being "code only" - without any weird GUIs that (in my apparently old mind) seem clunky and unintuitive. If I need further dev tools, I like to code them myself or use stuff like http://www.ogmoeditor.com/ that I can write import methods for. As a result I've stumbled over Phaser (and other HTML5 based frameworks) and they seem to offer the exact style of game development I like - but I couldn't find much about bundling games made with Phaser into native applications. Sure, there are things like cocoon.io, but those seem to be aimed at creating windows executables aimed for platforms like Steam. While I obviously want the option to release on PC/Steam, I don't really need mobile nor web - I'd rather have console instead. (I know about the difficulties related to releasing anything on console marketplaces and dealing with Sony etc. But my game would work quite nicely on consoles and I'd like to use an engine/framework that has the possibility for a largely pain-free porting process to consoles) tl:dr; So, my question is this: Is there any proven way to get a Phaser game (or some similiar HTML5 framework) ported to console? Or is there something else I'm missing that would satisfy my needs? thx guys
  3. Greeble, a #js13k entry

    Hello everyone! Last week I finished my #js13k entry, Greeble. I'd love it if you guys could give it a play and let me know what you think. http://js13kgames.com/entries/greeble
  4. WildCowboy

    Hello, game devs I created my first game WildCowboy with Phaser.js. This game is interpretation classic Sokoban. Game include 60 classic levels. I will be glad to hear your opinion and comments links: Web: itch.io Android: Google Play Regards.
  5. Hello everyone, Dot Snap return with new mission: The Battle Gameplay preview on youtube: https://www.youtube.com/watch?v=C4zc0cjBFWg Play the game online now: http://games.odiusfly.com/dotsnapbattle/full Available on google play store: https://play.google.com/store/apps/details?id=com.odiusflystudio.dotsnapbattle More games available on my website: http://odiusfly.com This game is available for licensing.. If you are interested, please contact me via email! ; -) Best regards, Kyriakos
  6. Remove SpriteSheet TextureCache

    I have loaded SpriteSheet using json. Like this below. const loader = new PIXI.loaders.Loader(); loader.add('bunny', 'data/bunny.png') .add('spaceship', 'assets/spritesheet.json'); loader.load((loader, resources) => { }); I want to remove all the TextureCache which was loaded using this spritesheet.json only. I have tried. PIXI.Texture.removeFromCache("spaceship"); PIXI.Texture.removeTextureFromCache("spaceship"); But in PIXI.TextureCache names of all the spriteFrame were included there. And still i am able to use image form frame. Using this. var bgSprite2 = PIXI.Sprite.fromFrame("ship1"); bgSprite2.anchor.set(0.5, 0.5); var pos = {x: 300, y: 200}; bgSprite2.position.set(pos.x, pos.y); stage.addChild(bgSprite2); I want to remove all the entries of spriteFrame in TextureCache and i want to load new set of spriteFrame. I am doing this because i have spritesheet animations of two diffrent spaceship but the individual symbol name of both spaceship are same. Please help.
  7. [Phaser] Space Blaze

    Hi! This is my second html5 game! It's a arcadey space "exploration" where the player jumps from planet to planet. The goal is to reach the wormholes that lead you to your ultimate destination. All feedback is welcome! Have fun! http://www.ludock.com/release/spaceblaze/
  8. Lumi's Journey [WIP]

    Hello! I’d like to announce the open beta release of Lumi’s Journey! This is HartBloom Studios’ first game. Lumi's Jouney is built in Construct 2 and uses Cocoon.io for compiling. Endless gameplay, 2D styling, and attempting to beat your friends’ high score is something I grew up with, so that’s what Lumi’s Journey is based around! Any critique or suggestions for gameplay, music, sound, and graphics is greatly appreciated! https://play.google.com/store/apps/details?id=com.lastlight
  9. Sky Fight now live

    Announcing skyfight.io, made with pixi, html5, php with the servers in c++, it has taken me 12 months which is about 5,000 hours on the code/art, it has been localised into 6 languages, with more work and languages to follow. I hope you like it The game has 7789 lines of JavaScript, 9430 lines of c++, and 984 lines of PHP/HTML with pixi as the graphics engine. I have UK/European and USA servers. so don't just sit there, get one up!!! http://skyfight.io/
  10. Hi, I was looking for free solutions to host my game in order to show them to publishers/sponsors? Do itch.io or Newgrounds work? Thanks!
  11. Hey everyone so I started my venture into programming months ago and started out with game maker language but didn't think I would ever get a job writing games in GML and so I stopped learning it and started learning HTML CSS and just recently 3 months or so ago got into what I thought would be super scary JavaScript, I dabbled in all the languages I could tbh and they all seemed so daunting. I didn't know what to do so I went back to HTML, CSS and JS. I think I understand JavaScript at a beginner level. My question how ever is.Is trying to study HTML5 game development as a sole hope to get a job doing it viable? I mean I can sit here and learn more on making websites but its not really my interest at all. I love games, playing em coming up with ideas to make em all of it. I would of learned Unity or Unreal but C# and C++ seemed so confusing to me, I like how JavaScript writes it just makes sense to me. But then when I start to make games and I've made some with tutorials with the Phase framework. I just get confused if I try to do it on my own. With Phaser I've done many many tutorials but I still can't seem to set out and just write it on my own. I just want to be able to one day make a game and have some kid stumble upon a kick ass browser game like I did years ago when I saw my neighbor playing Tibia and later RuneScape and thought it was the coolest thing ever. I know that RuneScape was originally written in Java and now C++, and Tibia was always a downloaded game idk what language it was written int but it does have a browser option now and I think thats amazing. Great games accessible anywhere with no download. Sources I've used to make games with Phaser Zenva Academy Interphase From Null to Full Lessmilks 2d Platformer Lessmilks Flappy Bird And I've even learned to just make games on the canvas with these 2 sources (no game engine.) GameKedo Intro to Canvas GameKedo Follow Up to beginner course Basically What I'm asking is if I should continue down this route and try to flesh out my skills and get a job for game development and what other sources or routes can I take to get there?
  12. Hello, Just finished my new game "Ball&Roll". It's my first attempt to use 3D assets with 2D engine. Playable link: http://powerthemes.eu/ballroll The game is still open for exclusive licensing.
  13. [Phaser] Copter Rescue

    Hello fellow game devs, I have made this game Copter Rescue in the recent few weeks, you can check it out on the this link: http://goo.gl/sCcnu2 Also contacted a few HTML5 game publisher and hoping that I will get a few offers for exclusive or non-exclusive licence, what do you think would be a fair price for a game like that? Thanks for your answers and your time. Feel free to discuss the game and what you like/dislike, I'm open to any kind of criticsm. Regards!
  14. Befive Lucky Five Video Poker

    I have had a random impulse to make a poker game a few days ago. URL : http://play.befive.info/lucky-five/ By the way, I have never played poker before. I have only seen them at game centers. Is this game working as it should be? Have I done right?
  15. Space 2

    I just finished a game for KenneyJam called Space 2. You can play it for free. Now that the jam is over, I'm looking to polish and refine it. Looking forward to some constructive feedback on gameplay. Game Play Description Earn experience points for destroying enemy ships and asteroids. Use that experience to upgrade your ship. You can upgrade your max health, regenerations speed, reload speed, ship speed, shot damage, and weapon speed. Fly around the universe and try to stay alive, see how many rounds of enemy ships you can defend. Controls Use the arrow keys or WASD to move your character around and the spacebar or left mouse button to shoot. Click on the abilities to increase them once you have ability points.
  16. Creating a slot game

    So I'm practicing Phaser by creating a slot machine, I've got most of it down but I'm having some issues with getting the reels to move and stop randomly. Here is my current code: <!DOCTYPE HTML><html> <head> <meta charset="UTF-8"/> <title>Slots </title> <script src="phaser.min.js"></script> </head> <body> <script type="text/javascript" > window.onload = function () { var game = new Phaser.Game(640,480, Phaser.CANVAS, 'd',{ preload: preload, create: create, update: update }); var seven; var bar; var twobar; var cherry; var cherry2; var tween; var spinning = false; var timer; var tick = 0; var reel1; var reel2; var reel3; var reel4; function preload() { // Pre load all images. //Cherry game.load.image('cherry', 'img/cherry.png'); // Bar game.load.image('bar', 'img/bar.png'); // TwoBars game.load.image('twoBar', 'img/twobar.png'); //seven game.load.image('seven', 'img/seven.png'); // Spin Button game.load.image('spin_button', 'img/spin_button.png'); // Machine_body game.load.image('machine_body', 'img/machine__body.png'); } function create() { var items = ['cherry', 'bar', 'seven', 'twoBar', 'cherry', 'bar', 'seven', 'twoBar']; reel1 = game.add.group(); // first reel. reel2 = game.add.group(); reel3 = game.add.group(); reel4 = game.add.group(); for(var i = 0; i < 5; i++) { sprite = reel1.create(5, i * 98 +3, items[game.rnd.integerInRange(0,5)]); sprite2 = reel2.create(131, i * 98 +3, items[game.rnd.integerInRange(0,5)]); sprite3 = reel3.create(258, i * 98 +3, items[game.rnd.integerInRange(0,5)]); sprite4 = reel4.create(386, i * 98 +3, items[game.rnd.integerInRange(0,5)]); } var body = game.add.sprite(0,0, 'machine_body'); var button = game.add.button(175, 400,'spin_button', actionOnClick, this); game.stage.backgroundColor = '#FFFFFF'; timer = game.time.create(false); timer.loop(3000, updateTicks, this); timer.start(); } function actionOnClick () { spinning = true; } function update() { if(spinning) { reel1.y += 50 reel2.y += 40; reel3.y += 57; reel4.y += 60; if(reel1.y >= 400){ reel1.y = 0; } if(reel2.y >= 400){ reel2.y = 0; } if(reel3.y >= 400){ reel3.y = 0; } if(reel4.y >= 400){ reel4.y = 0; } } var tween = game.add.tween(reel1); var tween2 = game.add.tween(reel2); var tween3 = game.add.tween(reel3); var tween4 = game.add.tween(reel4); tween.to({y: 180}, 60); tween2.to({y: 180}, 70); tween3.to({y: 180}, 80); tween4.to({y: 180}, 90); tween.start(); tween2.start(); tween3.start(); tween4.start(); } function updateTicks() { if(spinning){ spinning = false; } } } </script> </body></html> The idea is to have each reel as a group move down until it hits a threshold and then return to 0, after a timer expires it will tween to a stop with the closest element to the middle. The issue I have with this is that the final tween always seems to move the top element to the position rather than the closest element which is what I assume happens to a real slot machine leaving a gap on the top of the reel (see attached image). Assistance on getting each reel to move randomly and sorting out my button would also be great Thanks!
  17. HTML5 Game Developer

    Hello Looking for a HTML5 game developers to develop casual web games prefered with phaser framework. Please send me a message with your resume and links to your work and rate. tommyholmes84@gmail.com Regards Tommy
  18. Wedding Run (open source)

    Hi All! Intro As a front-end developer it was a MUST to create an online HTML5 game for our wedding website I've recently discovered Phaser and I was amazed by the things you can achive with it. The Phaser community is just awesome, I've got a lot of help from forums, examples and tutorials I've found during the development. I would like to give something back to the community. That's one of the reasons I've published the source code of the game. The game Wedding Run is an endless 2D platform game. You can play either with the groom or with the bride. The long as you will survive the more points you can achieve. Killing bunnies and collecting coins can raise your score! Have phun! Try it Try it online at http://www.zsondre.hu/wd/ Check out the source code at https://github.com/aendre/wedding-run
  19. Hello everyone, I want to present you my game, "Dot Snap". Gameplay preview on youtube: https://www.youtube.com/watch?v=x0J8J3DvVgg Play the game online now: http://games.odiusfly.com/dotsnap/full Available on google play store: https://play.google.com/store/apps/details?id=com.odiusflystudio.dotsnap More games available on my website: http://odiusfly.com This game is available for licensing.. If you are interested, please contact me via email! ; -) Best regards, Kyriakos
  20. Hi, My name is Bilge Kaan. I've been making HTML5 Games since 2013. You can check my portfolio here: http://td2tl.com Thank you, Bilge Kaan
  21. HTML 5 Game for Sale

    Hi We have a Car Wash games developed in Construct 2. Exclusive license game. Gameplay 5 cars : cleaning, deco the cars Interest do Message will send the game link for preview. Regards Sherin
  22. haha, I'm a old developer I started to make game from 2008 1. 2008-2017, flash game 2. 2015-2017, h5 game This game is used these engine and tools 1. H5 engine, LayaAir, this engine is very wonderful, I just used safari to play it, this game will have 55~60fps 2. UI IDE, FairyGUI, I can't find other UI EDIT IDE is good than it, I can use it do anything, and it's very very easy, it has timeline like flash, and it has more useful components. I can use it make UI on diffrient size of mobile, yeah, just use IDE, not source. 3. Spine, 3D animation tools LayaAir and FairyGUI are from chinese company, but it has english language. layaair -> http://www.layabox.com/en/ fairyGUI -> http://www.fairygui.com/en/ I hope you like my game, I hope I can find a good h5 game job, i can teach your team how to use LayaAir and FairyGUI, my email is bingqimao@qq.com Sorry, my english is not good. ^-^ first photo prove that I used h5 engine to make this game
  23. Y8 is Publishing HTML5 games

    For 10 years Y8 has been a big player in Flash games. Now that Flash is dying, we are looking to host more games using open standards. Everyone is welcome to submit games on the Y8 upload page. We are working on an adsense revenue split for game developers. So if you want to earn money, you will need to be at least 18 and it helps to have an Adsense account already. Though, in many cases we can help there too. So if you want to share your games, do these things: Upload here http://static.y8.com/upload If you want rev split email us here idnet@webgroup-limited.com Let us know if you have adsenses or not, list of games helps too.
  24. [Phaser] Truck Reign

    Hello, This game was made with Phaser framework, P2 Physics, Howler.js, localForage, phaser-ads plugin and wrapped with CocoonJS Google Play: Truck Reign Itch.io: https://alex-creativity.itch.io/truck-reign YouTube: Truck Reign Any feedback would be greatly appreciated!
  25. Phaser Game Lag In Mobile

    Hi, I am new to phaser as well as game designing. I created my first game as hobby using phaser. it is working fine in desktop but lags very bad on mobile devices. Images I am using for game is very small. game is smaller that 2mb. I am attaching my main.js file hope someone can help me. thanks var buttetSpwanSpeed; var bulletSpeed; var enemySpwanSpeed; var enemySpeed; var golis; var enemies; var enemyLoop; var scoreText; var powers; var bulletSize; setStart(); //game phaser var game=new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS,"gamearea"); var BootState={ //loding accets preload: function(){ this.load.image('LodingScreen', 'assets/desimulga.png'); this.load.image('background', 'assets/blue.png'); }, create: function(){ game.state.start("LoadingState"); }, }; var LoadingState={ //loding acc preload: function(){ bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; LodingScreen=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY,'LodingScreen'); LodingScreen.anchor.setTo(0.5); LodingScreen.scale.setTo(0.5,0.5); this.load.image('spaceship', 'assets/player.png'); this.load.image('goli', 'assets/bullet.png'); //load ememies this.load.image('enemy1', 'assets/enemies/enemy1.png'); this.load.image('enemy2', 'assets/enemies/enemy2.png'); this.load.image('enemy3', 'assets/enemies/enemy3.png'); this.load.image('enemy4', 'assets/enemies/enemy4.png'); this.load.image('enemy5', 'assets/enemies/enemy5.png'); this.load.spritesheet('power1', 'assets/power/bulletUp.png',34,33,4); this.load.image('restart', 'assets/restart.png'); this.load.spritesheet('blast', 'assets/explosion.png',400,400,8); game.load.audio('fire', 'assets/music/bullet.mp3'); game.load.audio('killed', 'assets/music/killed.mp3'); //game.load.audio('bg_music', 'assets/music/background.mp3'); game.load.audio('death_music', 'assets/music/death.mp3'); game.load.audio('start_music', 'assets/music/start.mp3'); }, create: function(){ game.time.events.add(Phaser.Timer.SECOND * 2, function(){ bg.kill(); LodingScreen.kill(); game.state.start("PreGameState"); },this); }, }; var PreGameState={ //loding accets create: function(){ game.scale.refresh(); bg=this.game.add.tileSprite(0,0,600,300,'background'); bg.height = game.height; bg.width = game.width; Startb=this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'TAP TO START' , { fontSize: '32px', fill: 'yellow' }); Startb.anchor.setTo(0.5); Startb.scale.setTo(0.5,0.5); ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.4,'spaceship'); ship.scale.setTo(0.4); ship.anchor.setTo(0.5); game.physics.arcade.enable(ship); bg.inputEnabled=true; start_music = game.add.audio('start_music'); start_music.allowMultiple = true; start_music.addMarker('start_music', 0, 30); bg.events.onInputDown.add(function(){ bg.inputEnabled=false; Startb.kill(); start_music.play("start_music"); // game.physics.arcade.moveToXY(ship, this.game.world.centerX, this.game.world.height*0.8, 300, 3000); // game.add.tween(ship).to( { y: game.world.height*0.8 }, 3000, Phaser.Easing.Sinusoidal.InOut, true); var tween = game.add.tween(ship).to({ x: [this.game.world.centerX, this.game.world.width*0, this.game.world.width, this.game.world.centerX], y: [this.game.world.height*0.4, this.game.world.height*0.5, this.game.world.height*0.6, this.game.world.height*0.8], }, 2000,Phaser.Easing.Quadratic.Out, true).interpolation(function(v, k){ return Phaser.Math.bezierInterpolation(v, k); }); game.time.events.add(Phaser.Timer.SECOND * 2, function() { bg.kill(); ship.kill(); game.state.start("GameState"); } ,this); }, this); }, }; var GameState={ //loding accets preload: function(){ }, create: function(){ //background this.background=this.game.add.tileSprite(0,0,600,300,'background'); this.background.height = game.height; this.background.width = game.width; this.background.inputEnabled=true; this.background.input.enableDrag(true); this.background.input.startDrag = function(pointer) { pointer.shipStart = new Phaser.Point(GameState.ship.x, GameState.ship.y); Phaser.InputHandler.prototype.startDrag.call(this, pointer); }; this.background.input.updateDrag = function(pointer) { GameState.ship.x = pointer.shipStart.x - pointer.positionDown.x + pointer.x; GameState.ship.y = pointer.shipStart.y - pointer.positionDown.y + pointer.y; GameState.background.x=0; GameState.background.y=0; }; //ship this.ship=this.game.add.sprite(this.game.world.centerX,this.game.world.height*0.8,'spaceship'); this.ship.scale.setTo(0.4); this.ship.anchor.setTo(0.5); game.physics.arcade.enable(this.ship); // this.ship.inputEnabled=true; // this.ship.input.enableDrag(true); //score this.scoreText = this.game.add.text(16, 16, 'Kills: 0', { fontSize: '32px', fill: '#fff' }); //background Music // music = game.add.audio('bg_music'); //music.play('', 0, 1, true); //bullet sound bullet_sound = game.add.audio('fire'); bullet_sound.allowMultiple = true; bullet_sound.volume=0.5; bullet_sound.addMarker('fire', 0, 0.5); //Killed sound killed_sound = game.add.audio('killed'); killed_sound.allowMultiple = true; killed_sound.addMarker('killed', 0, 0.5); //death music death_music = game.add.audio('death_music'); death_music.allowMultiple = true; death_music.addMarker('death_music', 0, 10); //groups of bullets and enemies golis=game.add.group(); enemies=game.add.group(); powers=game.add.group(); //fire bullet loop fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); //this.game.input.onTap.add(fireBullet, this); //create ememy loop enemyLoop=game.time.events.loop(Phaser.Timer.SECOND*1/enemySpwanSpeed, createEnemy, this); //change ememy speed and enemy spwan speed loop enemySpeedLoop=game.time.events.loop(Phaser.Timer.SECOND*1.5, changeEnemySpeed, this); //give powerup powerUp=game.time.events.loop(Phaser.Timer.SECOND*20, powerFun, this); }, update: function(){ //scrolling background this.background.tilePosition.y+=2; //keybord control if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) { this.ship.y-=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { this.ship.y+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { this.ship.x+=2; } if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { this.ship.x-=2; } //dont go out if(this.ship.y<0+this.ship.height/2) { this.ship.y=0+this.ship.height/2; } if(this.ship.y>this.game.world.height-this.ship.height/2) { this.ship.y=this.game.world.height-this.ship.height/2; } if(this.ship.x<0+this.ship.width/2) { this.ship.x=0+this.ship.width/2; } if(this.ship.x>this.game.world.width-this.ship.width/2) { this.ship.x=this.game.world.width-this.ship.width/2; } //check for collisions game.physics.arcade.overlap(golis,enemies,b_e_collide,null,this); game.physics.arcade.overlap(this.ship,enemies,s_e_collide,null,this); game.physics.arcade.overlap(this.ship,powers,s_power1_collide,null,this); }, }; //setting start game conditions function setStart(){ buttetSpwanSpeed=2; bulletSpeed=2000; enemySpwanSpeed=1; enemySpeed=300; score=0; bulletSize=1.2 } //fire bullet function function fireBullet(){ goli=this.game.add.sprite(this.ship.x,this.ship.y-this.ship.height/2,'goli'); goli.anchor.setTo(0.5); goli.scale.setTo(bulletSize,1); goli.checkWorldBounds = true; goli.outOfBoundsKill = true; //adding to group golis.add(goli); game.world.moveDown(goli); game.physics.arcade.enable(goli); goli.body.collisonWorldBounds=true; goli.body.velocity.y=-bulletSpeed; bullet_sound.play("fire"); } //create enemy function function createEnemy(){ enemyNo=game.rnd.integerInRange(1, 5); x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); enemy=this.game.add.sprite(x1,10,'enemy'+enemyNo); enemy.anchor.setTo(0.5); enemy.scale.setTo(0.4); enemy.checkWorldBounds = true; enemies.add(enemy); enemy.outOfBoundsKill = true; game.physics.arcade.enable(enemy); enemy.body.collisonWorldBounds=true; enemy.angle=90; enemy.no=enemyNo; //moving enemy angleRedian=game.physics.arcade.moveToXY(enemy, x2, this.game.world.height+enemy.height, enemySpeed,0); angleDegree=angleRedian*57.2958; enemy.angle=90+angleDegree; } //runs when bullet collide to enemy function b_e_collide(goli,enemy){ //blast blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',30,false,true); //killing goli.kill(); enemy.kill(); //update scores if(enemy.no<4) { score+=1; killed_sound.play('killed'); } this.scoreText.text = 'Kills: ' + score; } //runs when ship collide to enemy function s_e_collide(ship,enemy){ blast=this.game.add.sprite(enemy.x,enemy.y,'blast'); blast.anchor.setTo(0.5); blast.scale.setTo(0.5); var explosion=blast.animations.add('explosion'); blast.animations.play('explosion',10,false,true); ship.kill(); enemy.kill(); //music.stop(); this.scoreText.kill(); death_music.play("death_music"); game.time.events.remove(fireLoop); game.time.events.add(Phaser.Timer.SECOND * 2, function() { fianlScore = this.game.add.text(this.game.world.centerX,this.game.world.centerY, 'KILL: '+score, { fontSize: '32px', fill: 'yellow' }); fianlScore.anchor.setTo(0.5); gameOverText = this.game.add.text(this.game.world.centerX,this.game.world.centerY - fianlScore.height, 'GAME OVER', { fontSize: '32px', fill: 'red' }); gameOverText.anchor.setTo(0.5); //restart button restart=this.game.add.sprite(this.game.world.centerX,this.game.world.centerY + fianlScore.height+10,'restart'); restart.anchor.setTo(0.5); restart.scale.setTo(0.05,0.05); restart.inputEnabled = true; restart.events.onInputDown.add(restartGame, this); game.time.events.stop(); }, this); } //runs when ship collide power1 function s_power1_collide(ship,power){ power.kill(); game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/10, fireBullet, this); game.time.events.add(Phaser.Timer.SECOND * 10, function(){ game.time.events.remove(fireLoop); fireLoop=game.time.events.loop(Phaser.Timer.SECOND*1/buttetSpwanSpeed, fireBullet, this); },this); } function changeEnemySpeed() { if(enemySpeed<=900) { enemySpeed+=5; } if(enemySpwanSpeed<=3) { enemySpwanSpeed+=0.025; } enemyLoop.delay=Phaser.Timer.SECOND*1/enemySpwanSpeed; } //send power up function powerFun() { x1=game.rnd.integerInRange(0,this.game.world.width); x2=game.rnd.integerInRange(0,this.game.world.width); power=this.game.add.sprite(x1,10,'power1'); power.anchor.setTo(0.5); var shine=power.animations.add('shine'); power.animations.play('shine',5,true,true); power.checkWorldBounds = true; power.outOfBoundsKill = true; powers.add(power); game.physics.arcade.enable(power); power.body.collisonWorldBounds=true; game.physics.arcade.moveToXY(power, x2, this.game.world.height+power.height, 400,0); powerDelay=game.rnd.integerInRange(20,35); powerUp.delay=Phaser.Timer.SECOND*powerDelay; } function restartGame(){ setStart(); game.time.events.start(); game.state.start("PreGameState"); } game.state.add("GameState",GameState); game.state.add("BootState",BootState); game.state.add("LoadingState",LoadingState); game.state.add("PreGameState",PreGameState); game.state.start("BootState"); main.js