小编Joe*_*lor的帖子

使用键盘控件在画布游戏中平滑角色移动

我正在使用canvas和JavaScript创建一个横向滚动的无限空间主题游戏.我只是通过使用向上和向下箭头控制飞船,我想实施某种运动缓和,以便当我放开钥匙时船不会停止死亡.我环顾四周,没有找到任何东西加上我自己的尝试只是不起作用.这就是我尝试过的.

Jet.prototype.checkDirection = function () {
if (this.isUpKey) {
    this.drawY -= this.speed;
    if (this.speed < 5) {
        this.speed += 0.1;
    }
}
if (this.isDownKey) {
    this.drawY += this.speed;
    if (this.speed < 5) {
        this.speed += 0.1;
    }
}
if (!this.isUpKey) {
    if (!this.isDownKey) {
        if (this.speed >= 0) {
            this.drawY -= this.speed;
            this.speed -= 1;
        }
    }
}
if (!this.isDownKey) {
    if (!this.isUpKey) {
        if (this.speed >= 0) {
            this.drawY += this.speed;
            this.speed -= 1;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript canvas game-physics easing

13
推荐指数
1
解决办法
2万
查看次数

EmberJS - 断言失败:#each循环的值必须是一个数组.你通过了(生成的应用控制器)

我正在努力让我的模型的夹具数据渲染到我的模板,当我在模板中尝试每个循环时,我收到上面的错误:

{{#each}}
    {{title}}
{{/each}}
Run Code Online (Sandbox Code Playgroud)

我已经设置了我的路由器:

Application.Router.map(function() {
    this.resource('application', { path: '/' });
});

Application.ApplicationRoute = Ember.Route.extend({
    model: function() {
        return this.store.find('applicationmodel');
    }
});
Run Code Online (Sandbox Code Playgroud)

我的模型设置如下:

Application.ApplicationModel = DS.Model.extend({
    title: DS.attr('string')
});

Application.ApplicationModel.FIXTURES = [
    {
        id: 1,
        title: 'title-1'
    },
    {
        id: 2,
        title: 'title-2'
    }
];
Run Code Online (Sandbox Code Playgroud)

谁能告诉我我做错了什么?

谢谢

javascript ember.js ember-data

3
推荐指数
1
解决办法
4968
查看次数

PHP 日期格式 - 我可以使用“Sept”而不是“Sep”吗?

我正在尝试创建一个带有日期格式的网站,但我想在 9 月使用 Sept 而不是 Sep,这可能吗?

php

-2
推荐指数
1
解决办法
1611
查看次数

标签 统计

javascript ×2

canvas ×1

easing ×1

ember-data ×1

ember.js ×1

game-physics ×1

php ×1