renamed entities.
This commit is contained in:
@@ -1,36 +0,0 @@
|
|||||||
package game
|
|
||||||
|
|
||||||
import rl "vendor:raylib"
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
// Generic base structure shared by all world objects.
|
|
||||||
// Fields are populated selectively based on entity type.
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Entity_Type :: enum {
|
|
||||||
Player,
|
|
||||||
Enemy,
|
|
||||||
Ball,
|
|
||||||
}
|
|
||||||
|
|
||||||
Shape_Type :: enum {
|
|
||||||
Rectangle,
|
|
||||||
Circle,
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity :: struct {
|
|
||||||
type: Entity_Type,
|
|
||||||
active: bool,
|
|
||||||
pos: rl.Vector2,
|
|
||||||
shape: Shape_Type,
|
|
||||||
shape_size: rl.Vector2,
|
|
||||||
|
|
||||||
// Fixed input speed (paddles)
|
|
||||||
speed: f32,
|
|
||||||
// 2D momentum & direction (ball / physics)
|
|
||||||
vel: rl.Vector2,
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
// TODO: Entity Dispatchers
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package game
|
|
||||||
|
|
||||||
import rl "vendor:raylib"
|
|
||||||
|
|
||||||
init_ball :: proc() -> Entity {
|
|
||||||
ball_radius: f32 = 25
|
|
||||||
|
|
||||||
return Entity{
|
|
||||||
type = .Ball,
|
|
||||||
active = true,
|
|
||||||
pos = rl.Vector2{(WINDOW_WIDTH / 2), (WINDOW_HEIGHT / 2) - (ball_radius / 2)},
|
|
||||||
speed = 900,
|
|
||||||
shape = .Circle,
|
|
||||||
shape_size = rl.Vector2{25, 0}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render_ball :: proc(ball: Entity, field_bounds: rl.Rectangle) {
|
|
||||||
rl.DrawCircleV(ball.pos, ball.shape_size.x, rl.MAROON)
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package game
|
|
||||||
|
|
||||||
import rl "vendor:raylib"
|
|
||||||
|
|
||||||
init_enemy :: proc() -> Entity {
|
|
||||||
return Entity{
|
|
||||||
type = .Enemy,
|
|
||||||
active = true,
|
|
||||||
pos = rl.Vector2{0,0},
|
|
||||||
speed = 900,
|
|
||||||
shape = .Rectangle,
|
|
||||||
shape_size = rl.Vector2{50, 250}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render_enemy :: proc(enemy: Entity, field_bounds: rl.Rectangle) {
|
|
||||||
rl.DrawRectangleV(enemy.pos, enemy.shape_size, rl.BLACK)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user