71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera, TransformLinkAction
|
|
import "luxe: world/scene" for Scene
|
|
import "luxe: world/prototype" for Prototype
|
|
import "luxe: draw" for Draw, PathStyle
|
|
import "luxe: input" for Input, Key, InputType, Scan
|
|
import "luxe: assets" for Assets
|
|
import "luxe: asset" for Asset
|
|
import "luxe: math" for Math
|
|
import "luxe: io" for IO
|
|
import "debug: debug"
|
|
|
|
import "luxe: system/physics/box_collider3D.modifier" for BoxCollider3D
|
|
import "luxe: system/physics/character3D.modifier" for Character3D
|
|
import "camera: editor" for EditorCamera
|
|
import "camera: first_person" for FirstPersonCamera
|
|
import "outline/ready" for Ready
|
|
|
|
class Game is Ready {
|
|
|
|
construct ready() {
|
|
|
|
super("ready! %(width) x %(height) @ %(scale)x")
|
|
|
|
// set_use_debug_camera(true)
|
|
|
|
// _debug_cam = EditorCamera.new(world, camera, "any")
|
|
// _debug_cam.speed = 1
|
|
|
|
Scene.create(world, Asset.scene("scene/arena01"))
|
|
Scene.create(world, Asset.scene("scene/player"))
|
|
|
|
_player = Entity.get_named(world, "Player")
|
|
_fpscam = FirstPersonCamera.new(world, camera, "game")
|
|
|
|
var wpn: Entity = Prototype.create(world, Asset.prototype("prototype/wpn_waterpistol"))
|
|
var socket = Entity.create(world)
|
|
Transform.create(socket)
|
|
Transform.link(socket, camera, TransformLinkAction.reset_local)
|
|
Transform.set_pos(socket, 0.05, -0.2, -0.15)
|
|
|
|
Transform.link(wpn, socket, TransformLinkAction.reset_local)
|
|
|
|
Transform.set_pos_y(_player, 0.75)
|
|
|
|
Camera.set3D(camera, 85, width/height, 0.01, 500)
|
|
Transform.link(camera, _player, TransformLinkAction.reset_local)
|
|
Transform.set_pos_y(camera, 1.7)
|
|
Input.set_mouse_capture(true)
|
|
Input.set_mouse_visible(false)
|
|
|
|
Input.listen_for(InputType.key_down) {|key, scan, repeat, mod|
|
|
if(scan == Scan.grave) {
|
|
_fpscam.enabled = !_fpscam.enabled
|
|
Input.set_mouse_visible(_fpscam.enabled)
|
|
}
|
|
}
|
|
|
|
} //ready
|
|
|
|
tick(delta: Num) {
|
|
|
|
if(Input.key_state_released(Key.escape)) {
|
|
IO.shutdown()
|
|
}
|
|
|
|
// _debug_cam.tick(delta)
|
|
|
|
} //tick
|
|
|
|
} //Game
|