2ちゃんねる ■掲示板に戻る■ 全部 1- 最新50    

犬用のゲームをchat gptに作ってもらった

1 :わんにゃん@名無しさん:2024/06/29(土) 18:45:50.11 ID:13KICZOwM
ぜひ使ってくださいナ
https://runstant.com/noname_for_dog/projects/e1783a6e

2 :わんにゃん@名無しさん:2024/06/29(土) 21:42:14.21 ID:13KICZOwM
// index.html
<!DOCTYPE html> <html> <head> <title>Animal Game</title>
<script src="https://cdn.rawgit.com/phinajs/phina.js/v0.2.0/build/phina.js"></script>
<script src="game.js"></script> </head> <body> <canvas id="app"></canvas> </body> </html> // game.js phina.globalize(); // プレイヤーの動物クラス
phina.define('Player', { superClass: 'Sprite', init: function() {
this.superInit('animal_player', 64, 64); // プレイヤーの画像サイズを指定 this.speed = 4; // プレイヤーの移動速度 },
update: function(app) { var key = app.keyboard; if (key.getKey('left')) { this.x -= this.speed; } if (key.getKey('right')) { this.x += this.speed; }
if (key.getKey('up')) { this.y -= this.speed; } if (key.getKey('down')) { this.y += this.speed; } } }); // メインシーン
phina.define('MainScene', { superClass: 'DisplayScene', init: function() { this.superInit();
var player = Player().addChildTo(this); // プレイヤーキャラクターをシーンに追加
player.setPosition(this.gridX.center(), this.gridY.center()); // 画面中央に配置 },
update: function(app) { // ゲームの更新処理を記述する(アイテムの生成、衝突判定など)
} }); // ゲームアプリケーションの作成
phina.main(function() { var app = GameApp({ startLabel: 'main', assets: {
image: { 'animal_player': 'assets/animal.png', // プレイヤーの画像ファイルパス
// 他の画像ファイルもここで指定する } } });
app.run(); });
// index.php <!DOCTYPE html> <html> <head> <title>Animal Game</title>
<script src="https://cdn.rawgit.com/phinajs/phina.js/v0.2.0/build/phina.js"></script> <script src="game.js"></script>
</head> <body> <canvas id="app"></canvas> <div id="ranking">
<h2>ランキング</h2> <ul> {% for player in players %} <li>{{ player.name }} - スコア: {{ player.score }}</li>
{% endfor %} </ul> </div> <script> // バックエンドからのランキングデータを取得し、表示する
var players = {{ players|json_encode|raw }}; </script> </body> </html> // backend.php (ランキングのデータを取得する例)
<?php require_once 'vendor/autoload.php'; // TwigのAutoloadを読み込む
$loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/templates');
$twig = new \Twig\Environment($loader); // 仮のランキングデータを生成する
$players = array( array('name' => 'Alice', 'score' => 100), array('name' => 'Bob', 'score' => 80),
array('name' => 'Charlie', 'score' => 120) );
echo $twig->render('index.php', array('players' => $players));
?>

3 :わんにゃん@名無しさん:2024/06/29(土) 23:27:02.01 ID:13KICZOwM
extra pop game for dog
https://apkcombo.com/games-for-dogs/com.jaboston.doggames/download/apk

Lonely Dog Toy Dog Teasers
https://play.google.com/store/apps/details?id=com.petapps.lonelydogtoy

joipaw
https://joipaw.com/

4 :わんにゃん@名無しさん:2024/06/29(土) 23:28:22.57 ID:13KICZOwM
Joipawの買い方が分からなくて
困ってます

5 :わんにゃん@名無しさん:2024/06/29(土) 23:29:24.72 ID:13KICZOwM
サイコパスと真面目に戦うのは
時間が無駄だナ

6 :わんにゃん@名無しさん:2024/06/29(土) 23:30:38.31 ID:13KICZOwM
犬用のJoipawはモグラ叩きらしいけど
真似してchat gptで作ってもらおうかな

7 :わんにゃん@名無しさん:2024/06/29(土) 23:32:47.38 ID:13KICZOwM
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>犬用モグラ叩きゲーム</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}

#game-container {
text-align: center;
}

.mole {
width: 80px;
height: 80px;
background-color: #8b4513;
border-radius: 50%;
display: inline-block;
position: absolute;
cursor: pointer;
transition: transform 0.1s ease-out;
}

.mole.up {
transform: translateY(-20px);
}
</style>
</head>
<body>
<div id="game-container">
<h1>犬用モグラ叩きゲーム</h1>
<p>スコア: <span id="score">0</span></p>
</div>

<script src="game.js"></script>
</body>
</html>

8 :わんにゃん@名無しさん:2024/06/29(土) 23:33:20.49 ID:13KICZOwM
// game.js

document.addEventListener('DOMContentLoaded', function() {
const scoreDisplay = document.getElementById('score');
const gameContainer = document.getElementById('game-container');
const moles = [];

let score = 0;
const moleCount = 9;
const moleSpeed = 1000; // モグラが上がる間隔(ミリ秒)

// モグラを作成して配置する
for (let i = 0; i < moleCount; i++) {
const mole = document.createElement('div');
mole.className = 'mole';
moles.push(mole);
gameContainer.appendChild(mole);

// モグラをクリックしたときのイベントリスナーを追加
mole.addEventListener('click', () => {
if (!mole.classList.contains('up')) return; // モグラが上がっていない場合は無効

score++;
scoreDisplay.textContent = score;
mole.classList.remove('up');
});
}

// モグラをランダムに上げる関数
function popUpMole() {
const moleIndex = Math.floor(Math.random() * moleCount);
const mole = moles[moleIndex];

mole.classList.add('up');

setTimeout(() => {
mole.classList.remove('up');
}, moleSpeed);
}

// 定期的にモグラを上げる処理
setInterval(popUpMole, moleSpeed + 200);
});

7 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
名前: E-mail (省略可) :

read.cgi ver.24052200