sample source code for shooting games kimihito_ Follow 2011-12-01 08:36:09 License: MIT License Fork0 Fav0 View1891 Play Stop Reload Fullscreen Smart Phone Readme JavaScript 27 lines HTML 19 lines CSS 1 lines use enchant.js. i wanna create some shooting games. sample source code for shooting games enchant.js v0.4.0 enchant(); window.onload = function(){ var game = new Game(320, 320); game.preload('http://jsdo-it-static-contents.s3.amazonaws.com/assets/1/p/f/q/1pfqw.png'); game.onload = function(){ var aim = new Sprite(37, 37); aim.image = game.assets['http://jsdo-it-static-contents.s3.amazonaws.com/assets/1/p/f/q/1pfqw.png']; aim.x = 150; aim.y = 101; aim.scaleX = aim.scaleY = 0.3; aim.v = -1; aim.addEventListener('enterframe', function(e){ this.y += this.v * 1; if (this.y > 260) { this.v = -1; } else if (this.y < 20) { this.v = -1; } }); game.rootScene.addChild(aim); } game.start(); } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <title>enchant</title> <script type="text/javascript" src="enchant.js"></script> <script type="text/javascript" src="game.js"></script> <style type="text/css"> body { margin: 0; } </style> </head> <body> </body> </html> sample source code for shooting games body { background-color: #DDDDDD; font: 30px sans-serif; } use enchant.js. i wanna create some shooting games. enchant(); window.onload = function(){ var game = new Game(320, 320); game.preload('http://jsdo-it-static-contents.s3.amazonaws.com/assets/1/p/f/q/1pfqw.png'); game.onload = function(){ var aim = new Sprite(37, 37); aim.image = game.assets['http://jsdo-it-static-contents.s3.amazonaws.com/assets/1/p/f/q/1pfqw.png']; aim.x = 150; aim.y = 101; aim.scaleX = aim.scaleY = 0.3; aim.v = -1; aim.addEventListener('enterframe', function(e){ this.y += this.v * 1; if (this.y > 260) { this.v = -1; } else if (this.y < 20) { this.v = -1; } }); game.rootScene.addChild(aim); } game.start(); } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <title>enchant</title> <script type="text/javascript" src="enchant.js"></script> <script type="text/javascript" src="game.js"></script> <style type="text/css"> body { margin: 0; } </style> </head> <body> </body> </html> body { background-color: #DDDDDD; font: 30px sans-serif; } use an iframe compat browser, deer Play on jsdo.it games Author Share ブログに埋め込む QR Tag Download Complete! Description What kind of game? use enchant.js. i wanna create some shooting games. Control Device Smartphone Controllerjsdo.it WebSocket Controller» Mouse Keyboard Touch Device Fullscreen Activated Inactivated jsdo.it games から削除する Submit Author kimihito_ URLhttp://d.hatena.ne.jp/kimihito/ 白身が食べれません。 twitter: kimihito_ skype: kimihito_bohkun Tweet Default Panel Auto play Screenshot Readme JavaScript HTML CSS Size Width: px Height: px code <script type="text/javascript" src="http://jsdo.it/blogparts/mZEi/js"></script> enchant.js game, Discussion Questions on this code? Tags enchant.js game,