Committed start of project
This commit is contained in:
65
game.wren
Normal file
65
game.wren
Normal file
@ -0,0 +1,65 @@
|
||||
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera, Scene, Body3D
|
||||
import "luxe: draw" for Draw, PathStyle
|
||||
import "luxe: input" for Input, Key
|
||||
import "luxe: assets" for Assets
|
||||
import "luxe: asset" for Asset
|
||||
import "luxe: math" for Math
|
||||
import "luxe: io" for IO
|
||||
|
||||
import "luxe: system/physics/box_collider3D.modifier" for BoxCollider3D
|
||||
import "camera: editor" for EditorCamera
|
||||
import "outline/ready" for Ready
|
||||
|
||||
class Game is Ready {
|
||||
|
||||
var opened_level: Bool = false
|
||||
|
||||
construct ready() {
|
||||
|
||||
super("ready! %(width) x %(height) @ %(scale)x")
|
||||
|
||||
Transform.set_pos(camera, 0, 1, 4)
|
||||
Transform.set_euler_x(camera, -0.25)
|
||||
|
||||
set_use_debug_camera(true)
|
||||
|
||||
_debug_cam = EditorCamera.new(world, camera, "any")
|
||||
_debug_cam.speed = 1
|
||||
|
||||
// Bandage fix for a bug where Jolt with crash the
|
||||
// game if you load a scene with a collider when
|
||||
// the world has zero mass. So here, I explicitly
|
||||
// make a collider to give the world mass.
|
||||
var mass_fix = Entity.create(world)
|
||||
Log.print("Created mass_fix: %(Entity.get_uuid(mass_fix))")
|
||||
|
||||
Scene.create(world, Asset.scene("scene/arena01"))
|
||||
|
||||
// Entity.destroy(mass_fix)
|
||||
|
||||
} //ready
|
||||
|
||||
tick(delta: Num) {
|
||||
|
||||
if(Input.key_state_released(Key.escape)) {
|
||||
IO.shutdown()
|
||||
}
|
||||
|
||||
if (Input.key_state_released(Key.key_o) && !opened_level) {
|
||||
Scene.create(world, Asset.scene("scene/map_load"))
|
||||
opened_level = true
|
||||
}
|
||||
|
||||
if (_using_debug_cam) {
|
||||
_debug_cam.tick(delta)
|
||||
}
|
||||
|
||||
} //tick
|
||||
|
||||
set_use_debug_camera(use_debug: Bool) {
|
||||
_using_debug_cam = use_debug
|
||||
Input.set_mouse_capture(!use_debug)
|
||||
Input.set_mouse_visible(use_debug)
|
||||
}
|
||||
|
||||
} //Game
|
||||
Reference in New Issue
Block a user