我正在使用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) 我正在努力让我的模型的夹具数据渲染到我的模板,当我在模板中尝试每个循环时,我收到上面的错误:
{{#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)
谁能告诉我我做错了什么?
谢谢
我正在尝试创建一个带有日期格式的网站,但我想在 9 月使用 Sept 而不是 Sep,这可能吗?