Build Your Game
Use the FORGE Game Engine to build your own games. ECS, physics, audio โ all built in.
module MyGame {
use engine.ecs
use engine.physics
use engine.math
@parallel
fn update(dt: f32, world: World) -> void {
let enemies = world.query(Enemy)
for entity in enemies {
let body = world.getComponent(RigidBody, entity)
body.vel = body.vel + Vec2 { x: 0.0, y: -9.8 * dt }
}
}
fn main() -> void {
let world = World.init()
let player = world.spawn()
world.addComponent(RigidBody, player, RigidBody {
pos: Vec2 { x: 0.0, y: 0.0 },
vel: Vec2 { x: 1.0, y: 0.0 },
mass: 70.0,
restitution: 0.5
})
}
}
$ forge game new mygame
$ cd mygame && forge run game.forge