Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kurumayusamugariko/otamesi
Browse files Browse the repository at this point in the history
  • Loading branch information
yuika366 committed Feb 11, 2024
2 parents 9ebf5fd + 187213d commit 66fcfe8
Show file tree
Hide file tree
Showing 29 changed files with 3,148 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
package-lock.json
package.json
modules
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"metamon",
"metown"
]
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# kurumayusamugariko
### お試し用リポジトリです

\絶賛公開中 遊んでみてね/




1.[ブロック崩しゲーム](https://kurumayusamugariko.github.io/otamesi/game)
---
<img src="https://img.shields.io/badge/-Javascript-black.svg?logo=javascript&style=popout-square"> <img src="https://img.shields.io/badge/-Node.js-black.svg?logo=node.js&style=popout-square">

23 changes: 23 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let express = require("express");
let app = express();
const bodyParser = require('body-parser');

app.use(express.urlencoded({ extended: true }));
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json());

app.get('/', (request, response) => {
response.sendFile(__dirname + '/game.html');
});

app.get('/2', (request, response) => {
response.sendFile(__dirname + '/game2.html');
});

app.use((req, res, next) => {
res.status(404).send("<h1>ページが見つかりません</h1>");
});

app.listen(8080, () => {
console.log("Start Server on port 8080!");
});
805 changes: 805 additions & 0 deletions battlezone.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//playerのアニメーション
class Sprite {
constructor({ position, velocity, image, frames = { max: 1 }, sprites }) {
this.position = position;
this.image = image;
this.frames = { ...frames, val: 0, elapsed: 0 };

this.image.onload = () => {
this.width = this.image.width / this.frames.max;
this.height = this.image.height;
};
this.moving = false;
this.sprites = sprites;
}

draw() {
c.drawImage(
this.image,
this.frames.val * this.width,
0,
this.image.width / this.frames.max,
this.image.height,
this.position.x,
this.position.y,
this.image.width / this.frames.max,
this.image.height
);

if (!this.moving) return

if (this.frames.max > 1) {
this.frames.elapsed++;
}

//フレームの切り替え
if (this.frames.elapsed % 10 === 0) {
if (this.frames.val < this.frames.max - 1) this.frames.val++;
else this.frames.val = 0;
}

}
}

class Boundary {
static width = 48.2;
static height = 48;
constructor({ position }) {
this.position = position;
this.width = 40;
this.height = 20;
}
//当たり判定の描画
draw() {
c.fillStyle = "rgba(255, 0, 0, 0.2)"; //透明
c.fillRect(this.position.x, this.position.y, this.width, this.height);
}
}
61 changes: 61 additions & 0 deletions data/battleZones.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66fcfe8

Please sign in to comment.