Skip to content

Commit d768860

Browse files
committed
refactor: phaser rewrite
1 parent 8412dc6 commit d768860

21 files changed

Lines changed: 4430 additions & 133 deletions

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="icon" type="image/svg+xml" href="public/bee-icon.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React</title>
7+
<title>Bee-ware!</title>
88
</head>
99
<body>
1010
<div id="root"></div>
11-
<script type="module" src="/src/main.jsx"></script>
11+
<script type="module" src="/src/main.tsx"></script>
1212
</body>
1313
</html>

package-lock.json

Lines changed: 1286 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
897 Bytes
Loading
654 Bytes
Loading

public/bee-icon.svg

Lines changed: 23 additions & 0 deletions
Loading

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
2-
import './App.css';
2+
import './styles/App.css';
33
import Game from './components/Game';
44

55
// Define public paths for images
6-
const headerImage = '/bee-ware/assets/images/beeware-header.png';
7-
const borderImage = '/bee-ware/assets/images/beeware-border.png';
6+
const headerImage = '/bee-ware/assets/images/ui/beeware-header.png';
7+
const borderImage = '/bee-ware/assets/images/ui/beeware-border.png';
88

99
const App: React.FC = () => {
1010
return (

src/components/Game.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useRef } from 'react';
22
import Phaser from 'phaser';
3-
import MainScene from '../scenes/MainScene';
3+
import MainScene from '../phaser/scenes/MainScene';
44

55
const Game: React.FC = () => {
66
const gameRef = useRef<Phaser.Game | null>(null);

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { StrictMode } from 'react'
22
import { createRoot } from 'react-dom/client'
3-
import './index.css'
3+
import './styles/index.css'
44
import App from './App'
55

66
createRoot(document.getElementById('root')!).render(

src/phaser/config/GameConfig.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Main game configuration constants
3+
*/
4+
export const GAME_CONFIG = {
5+
PLAYER: {
6+
SPEED: 200,
7+
SCALE: 0.5,
8+
DEPTH: 10,
9+
HITBOX_SCALE: 0.8,
10+
ATTACK_INTERVAL: 500, // ms between attacks
11+
MAX_HEALTH: 100, // Maximum player health
12+
DAMAGE_INTERVAL: 500, // ms between damage ticks when overlapping enemies
13+
DAMAGE_AMOUNT: 5, // Amount of damage taken per tick
14+
DAMAGE_TINT: 0xff0000, // Red tint when damaged
15+
INVULNERABLE_DURATION: 1000, // ms of invulnerability after taking damage
16+
HEALTH_BAR_WIDTH: 200, // Width of health bar in pixels
17+
HEALTH_BAR_HEIGHT: 20, // Height of health bar in pixels
18+
EXPERIENCE: {
19+
PICKUP_RADIUS: 10, // Radius in pixels for auto-pickup
20+
MAGNET_RADIUS: 150, // Radius in pixels for experience magnet effect
21+
MAGNET_SPEED: 300 // Speed at which orbs move toward player when in magnet radius
22+
}
23+
},
24+
ENEMY: {
25+
SPEED: 120,
26+
SCALE: 0.4,
27+
DEPTH: 5,
28+
SPAWN_INTERVAL: 1000, // ms between spawns
29+
MAX_COUNT: 50,
30+
SPAWN_PADDING: 20, // Distance from edge
31+
HITBOX_SCALE: 0.8,
32+
TINT: 0xff0000,
33+
MAX_HEALTH: 3, // Number of hits to defeat an enemy
34+
DAMAGE_TINT: 0xff8800, // Orange tint when damaged
35+
KNOCKBACK_FORCE: 150, // Force applied when hit
36+
KNOCKBACK_DURATION: 200, // ms of knockback effect
37+
EXPERIENCE_DROP_CHANCE: 1.0 // Chance (0-1) of dropping an experience orb
38+
},
39+
EXPERIENCE_ORB: {
40+
KEY: 'experience_orb',
41+
SCALE: 0.3,
42+
DEPTH: 3,
43+
TINT: 0x00ffff, // Cyan color
44+
VALUE: 1, // Each orb gives 1 XP, player needs 25 for first level up
45+
LIFESPAN: 10000, // ms before disappearing
46+
MAX_COUNT: 100, // Maximum number of orbs
47+
PULSE_DURATION: 1000, // ms for pulse animation
48+
PULSE_SCALE: 1.2 // Maximum scale during pulse
49+
},
50+
PROJECTILE: {
51+
PLAYER: {
52+
KEY: 'player_projectile',
53+
SPEED: 400,
54+
SCALE: 0.3,
55+
DEPTH: 8,
56+
MAX_COUNT: 100,
57+
LIFESPAN: 2000, // ms
58+
TINT: 0xffff00, // Yellow color
59+
DAMAGE: 1
60+
}
61+
},
62+
UI: {
63+
TEXT_STYLE: {
64+
fontSize: '18px',
65+
color: '#ffffff',
66+
strokeThickness: 2,
67+
stroke: '#000000'
68+
}
69+
}
70+
};
71+
72+
/**
73+
* Default camera dimensions if not specified elsewhere
74+
*/
75+
export const DEFAULT_DIMENSIONS = {
76+
WIDTH: 1024,
77+
HEIGHT: 768
78+
};

0 commit comments

Comments
 (0)