phaser实现一个跳跃类小游戏代码

代码语言:html

所属分类:游戏

代码描述:phaser实现一个跳跃类小游戏代码,按住键盘上下左右键控制跳跃及方向。

代码标签: phaser 跳跃 游戏

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">






</head>

<body>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/phaser.2.0.5.js"></script>
    <script>
        var Jumper = function() {};
        Jumper.Play = function() {};
        
        Jumper.Play.prototype = {
        
          preload: function() {
            this.load.image( 'hero', '//repo.bfw.wiki/bfwrepo/images/phaser/dude.png' );
            this.load.image( 'pixel', '//repo.bfw.wiki/bfwrepo/images/phaser/pixel_1.png' );
          },
        
          create: function() {
            // background color
            this.stage.backgroundColor = '#6bf';
        
            // scaling
            this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
            this.scale.maxWidth = this.game.width;
            this.scale.maxHeight = this.game.height;
            this.scale.pageAlignHorizontally = true;
            this.scale.pageAlignVertically = true;
            thi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0