ship and camera in
This commit is contained in:
parent
9775f76e1c
commit
b0de456c74
12 changed files with 118 additions and 305 deletions
|
|
@ -1,3 +0,0 @@
|
|||
name = "empty"
|
||||
description = "An empty project, with a game world and a ui world.\nDefaults to 2D cameras mapped to window size,\nand handles basic rendering and updating."
|
||||
keywords = ["empty", "blank", "2D"]
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
layer = {
|
||||
elements = {} //elements
|
||||
} //layer
|
||||
217
game.wren
217
game.wren
|
|
@ -1,22 +1,19 @@
|
|||
import "luxe: game" for Game
|
||||
import "luxe: game" for Ready
|
||||
import "luxe: assets" for Assets
|
||||
import "luxe: input" for Input, Key
|
||||
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera, Text
|
||||
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera
|
||||
import "luxe: render" for Material
|
||||
import "luxe: math" for Math
|
||||
import "luxe: draw" for Draw, PathStyle
|
||||
import "luxe: draw" for Draw
|
||||
import "luxe: io" for IO
|
||||
import "random" for Random
|
||||
// import "luxe: array" for Lists
|
||||
|
||||
import "outline/app" for App
|
||||
|
||||
class game is Game {
|
||||
class Game is Ready {
|
||||
|
||||
construct ready() {
|
||||
|
||||
//todo: get animation going on ship/exhaust duh
|
||||
//todo: ammo. initialize a bunch of entities (bullets) into a list, when fired, add one to another list. that second list gets run through every tick, and we update the position of each bullet. then recycle them after a while
|
||||
System.print("ready!")
|
||||
super("ready!")
|
||||
|
||||
app = App.new()
|
||||
app.color = [0,0,0,1]
|
||||
|
|
@ -24,226 +21,38 @@ class game is Game {
|
|||
|
||||
// game vars
|
||||
// camera
|
||||
_camera_scale = 2
|
||||
_camera_scale = 3
|
||||
_cam_offset_x = (app.width / 2 / _camera_scale)
|
||||
_cam_offset_y = (app.height / 2 / _camera_scale)
|
||||
|
||||
// starfield
|
||||
_stars = []
|
||||
|
||||
// player ship
|
||||
_input_vec = []
|
||||
_ship_rotation = 0
|
||||
_ship_speed = 40
|
||||
_ship_acceleration_x = 0
|
||||
_ship_acceleration_y = 0
|
||||
_ship_velocity_x = 0
|
||||
_ship_velocity_y = 0
|
||||
_ship_dampening = 0.85
|
||||
|
||||
Camera.ortho(app.camera, 0, 0, _cam_offset_x * 2, _cam_offset_y * 2, -5, 5)
|
||||
Camera.ortho(app.camera, 0, _cam_offset_y * 2, _cam_offset_x * 2, 0, -5, 5)
|
||||
|
||||
create_ship()
|
||||
create_ui_text()
|
||||
create_asteroid(5, 10)
|
||||
create_startracker()
|
||||
create_starfield()
|
||||
Transform.set_pos(app.camera, Transform.get_pos_x(_ship) - _cam_offset_x, Transform.get_pos_y(_ship) - _cam_offset_y)
|
||||
|
||||
// NOTES
|
||||
// z-layers: -1 stars, 0 player ship
|
||||
// camera stuff: we're moving the ship in the world, based on input. then, moving the camera,
|
||||
// with lerp, based on where the ship goes. then, moving star_tracker to the camera position,
|
||||
// with offset. positions and offsets react to _camera_scale
|
||||
|
||||
} //ready
|
||||
|
||||
tick(delta) {
|
||||
tick_ship(delta)
|
||||
tick_camera(delta)
|
||||
tick_starfield(delta)
|
||||
something_else()
|
||||
|
||||
if(Input.key_state_released(Key.escape)) {
|
||||
IO.shutdown()
|
||||
}
|
||||
|
||||
app.tick(delta)
|
||||
} //tick
|
||||
|
||||
//////////////
|
||||
// CREATORS //
|
||||
//////////////
|
||||
|
||||
something_else() {
|
||||
|
||||
}
|
||||
|
||||
// CREATORS
|
||||
create_ship() {
|
||||
_ship = Entity.create(app.world, "ship")
|
||||
Transform.create(_ship)
|
||||
var ship_mat = Assets.material("material/ship")
|
||||
Sprite.create(_ship, ship_mat, 16, 32)
|
||||
Transform.set_pos(_ship, 0, 0)
|
||||
Transform.create(_ship)
|
||||
Transform.set_pos(_ship, app.width/2 / _camera_scale, app.height/2 / _camera_scale)
|
||||
} //create_ship
|
||||
|
||||
create_ui_text() {
|
||||
_position_text = Entity.create(app.ui)
|
||||
_mat_font = Assets.material("luxe: material/font")
|
||||
Transform.create(_position_text)
|
||||
Transform.set_pos(_position_text, app.width / 2 - 35, app.height - 50)
|
||||
Text.create(_position_text, _mat_font, 32, "fonts/lato", [1,1,1,1])
|
||||
} //create_ui_text
|
||||
|
||||
create_asteroid(x, y) {
|
||||
_asteroid = Entity.create(app.world, "asteroid")
|
||||
Transform.create(_asteroid)
|
||||
var asteroid_mat = Assets.material("material/asteroid")
|
||||
Sprite.create(_asteroid, asteroid_mat, 32, 32)
|
||||
Transform.set_pos(_asteroid, x, y)
|
||||
} //create_asteroid
|
||||
|
||||
create_startracker() {
|
||||
_star_tracker = Entity.create(app.world, "star_tracker")
|
||||
Transform.create(_star_tracker)
|
||||
Transform.set_pos(_star_tracker, Transform.get_pos_x(_ship), Transform.get_pos_y(_ship), Transform.get_pos_z(_ship))
|
||||
} //create_startracker
|
||||
|
||||
create_starfield() {
|
||||
// sometimes you come back to some code and don't remember exactly how it all works
|
||||
// that's ok, just trust that past you figured this out, and it works how you want it to
|
||||
// hopefully you can figure it out later if needed
|
||||
//
|
||||
// this makes the starfield background, with randomness applied to the position, size, and set_alpha
|
||||
// of each star. stars are parented to _star_tracker, which follows the player around
|
||||
|
||||
// put a value in the new() call to make the same starfield each time
|
||||
var rng = Random.new()
|
||||
var number_of_stars = 500
|
||||
|
||||
for(i in 0...number_of_stars) {
|
||||
var randomness = rng.float(0.5)
|
||||
var randomness_x = rng.float()
|
||||
var randomness_y = rng.float()
|
||||
_star = Entity.create(app.world, "star")
|
||||
Transform.create(_star)
|
||||
Transform.set_pos(_star, (app.width * randomness_x) - (app.width / 2), (app.height * randomness_y) - (app.height / 2), -1)
|
||||
var star_mat = Assets.material("material/star")
|
||||
Sprite.create(_star, star_mat, 8 * randomness, 8 * randomness)
|
||||
Sprite.set_alpha(_star, randomness)
|
||||
// Sprite.set_color(_star, 1, 1, 0, 1)
|
||||
Transform.link(_star, _star_tracker)
|
||||
_stars.add(_star)
|
||||
}
|
||||
// debug red star
|
||||
// Sprite.set_color(_stars[1], 1, 0, 0, 1)
|
||||
} //create_starfield
|
||||
|
||||
//////////////
|
||||
// UPDATERS //
|
||||
//////////////
|
||||
|
||||
tick_ship(delta) {
|
||||
var input_vec = [get_axis("horizontal"), get_axis("vertical")]
|
||||
Math.normalize2D(input_vec)
|
||||
|
||||
// 2d movement physics
|
||||
_ship_acceleration_x = input_vec.x * _ship_speed
|
||||
_ship_acceleration_y = input_vec.y * _ship_speed
|
||||
_ship_velocity_x = _ship_velocity_x + (_ship_acceleration_x * delta)
|
||||
_ship_velocity_y = _ship_velocity_y + (_ship_acceleration_y * delta)
|
||||
_ship_velocity_x = _ship_velocity_x * _ship_dampening
|
||||
_ship_velocity_y = _ship_velocity_y * _ship_dampening
|
||||
|
||||
// rotate ship in direction of movement, if input is detected (solves snap at vel=0)
|
||||
if(input_vec.x != 0 || input_vec.y != 0) {
|
||||
_ship_rotation = Math.atan2(_ship_velocity_y, _ship_velocity_x) + Math.radians(90)
|
||||
Transform.set_euler_world(_ship, 0, 0, _ship_rotation)
|
||||
}
|
||||
|
||||
// move ship
|
||||
Transform.translate(_ship, _ship_velocity_x, _ship_velocity_y)
|
||||
|
||||
// update position text
|
||||
var ship_pos_x_int = Math.floor_around_zero(Transform.get_pos_x(_ship))
|
||||
var ship_pos_y_int = Math.floor_around_zero(Transform.get_pos_y(_ship))
|
||||
Text.set_text(_position_text, "[%(ship_pos_x_int), %(ship_pos_y_int)]")
|
||||
} //tick_ship
|
||||
|
||||
tick_camera(delta) {
|
||||
// move the camera, with some lerp delay, along with the ship
|
||||
var shipx = Transform.get_pos_x(_ship)
|
||||
var shipy = Transform.get_pos_y(_ship)
|
||||
var camerax = Transform.get_pos_x(app.camera)
|
||||
var cameray = Transform.get_pos_y(app.camera)
|
||||
var interpolation = 0.8
|
||||
var camera_interp_x = lerp(shipx - _cam_offset_x, camerax, interpolation)
|
||||
var camera_interp_y = lerp(shipy - _cam_offset_y, cameray, interpolation)
|
||||
Transform.set_pos(app.camera, camera_interp_x, camera_interp_y)
|
||||
} //tick_camera
|
||||
|
||||
tick_starfield(delta) {
|
||||
//todo: 20191130 - found an interesting bug, where if you (while going super fast) travel out too far, and return to [0,0], the stars will be slightly misaligned. must have something to do with a floating point error while moving the stars around. Went to 25,000 out and saw a slight misalign
|
||||
// to fix, can make scrolling more accurate somehow, maybe track a stars movement and see where it gets it's error. probably when having them switch sides
|
||||
// another option is to restrict how far out the player can travel from [0,0], either with a hard limit, or some gameplay thing that makes them stay close to base
|
||||
Transform.set_pos(_star_tracker, Transform.get_pos_x(app.camera) + _cam_offset_x, Transform.get_pos_y(app.camera) + _cam_offset_y, -1)
|
||||
// loop through stars[]
|
||||
for(star in _stars) {
|
||||
Transform.set_pos_x(star, Transform.get_pos_x(star) + -_ship_velocity_x * (Sprite.get_alpha(star) * 0.5))
|
||||
Transform.set_pos_y(star, Transform.get_pos_y(star) + -_ship_velocity_y * (Sprite.get_alpha(star) * 0.5))
|
||||
|
||||
// x pos reset
|
||||
if(Transform.get_pos_x(star) > _cam_offset_x * _camera_scale) {
|
||||
Transform.set_pos_x(star, -_cam_offset_x * _camera_scale)
|
||||
}
|
||||
if(Transform.get_pos_x(star) < -_cam_offset_x * _camera_scale) {
|
||||
Transform.set_pos_x(star, _cam_offset_x * _camera_scale)
|
||||
}
|
||||
|
||||
// y pos reset
|
||||
if(Transform.get_pos_y(star) > _cam_offset_y * _camera_scale) {
|
||||
Transform.set_pos_y(star, -_cam_offset_y * _camera_scale)
|
||||
}
|
||||
if(Transform.get_pos_y(star) < -_cam_offset_y * _camera_scale) {
|
||||
Transform.set_pos_y(star, _cam_offset_y * _camera_scale)
|
||||
}
|
||||
}
|
||||
} //tick_starfield
|
||||
|
||||
/////////////
|
||||
// HELPERS //
|
||||
/////////////
|
||||
|
||||
get_axis(axis) {
|
||||
if(axis == "horizontal") {
|
||||
var xaxis = 0
|
||||
if(Input.key_state_down(Key.key_a) || Input.key_state_down(Key.left)) {
|
||||
xaxis = xaxis - 1
|
||||
}
|
||||
if(Input.key_state_down(Key.key_d) || Input.key_state_down(Key.right)) {
|
||||
xaxis = xaxis + 1
|
||||
}
|
||||
return xaxis
|
||||
}
|
||||
if(axis == "vertical") {
|
||||
var yaxis = 0
|
||||
if(Input.key_state_down(Key.key_w) || Input.key_state_down(Key.up)) {
|
||||
yaxis = yaxis - 1
|
||||
}
|
||||
if(Input.key_state_down(Key.key_s) || Input.key_state_down(Key.down)) {
|
||||
yaxis = yaxis + 1
|
||||
}
|
||||
return yaxis
|
||||
}
|
||||
} //get_axis
|
||||
|
||||
lerp(a, b, t) {
|
||||
return a + t * (b - a)
|
||||
} //lerp
|
||||
|
||||
destroy() {
|
||||
|
||||
System.print("unready!")
|
||||
app.destroy()
|
||||
|
||||
} //destroy
|
||||
|
||||
app { _app }
|
||||
|
|
|
|||
126
log.txt
126
log.txt
|
|
@ -1,70 +1,70 @@
|
|||
luxe / Engine / Fri Nov 29 15:49:09 2019
|
||||
luxe / Engine / Sat Sep 19 11:33:41 2020
|
||||
luxe / Engine / path is `/Users/jonathan/Developer/luxe/space`
|
||||
luxe / Engine / 1.0.0-dev.84
|
||||
luxe / API / 1.0.0-dev.84
|
||||
luxe / Runtime / 1.0.0-dev.84
|
||||
luxe / Engine / 2020.3.0
|
||||
luxe / paths / root / located at `/Users/jonathan/.luxe`
|
||||
luxe / paths / modules / located at `/Users/jonathan/.luxe/modules`
|
||||
luxe / dev / project / runtime version specified as `2020.3.0`
|
||||
luxe / dev / project / runtime ok `2020.3.0` `2020.3.0`
|
||||
luxe / API / 2020.3.0
|
||||
luxe / Runtime / 2020.3.0
|
||||
luxe / project / syncing dependency / `luxe` @ `2020.3.0` => `/Users/jonathan/.luxe/modules/luxe/2020.3.0`
|
||||
luxe / dev / parcel / adding dependency assets and units
|
||||
luxe / dev / parcel / adding dependency `luxe` @ `1.0.0-dev.84`
|
||||
luxe / dev / parcel / - adding scripts from `/Users/jonathan/.luxe/modules/luxe/1.0.0-dev.84/api`
|
||||
luxe / dev / parcel / - adding assets from `/Users/jonathan/.luxe/modules/luxe/1.0.0-dev.84/assets`
|
||||
luxe / dev / parcel / adding dependency `luxe` @ `2020.3.0`
|
||||
luxe / dev / parcel / - adding scripts from `/Users/jonathan/.luxe/modules/luxe/2020.3.0/api`
|
||||
luxe / dev / parcel / - adding assets from `/Users/jonathan/.luxe/modules/luxe/2020.3.0/assets`
|
||||
luxe / dev / images / adding unreferenced sources...
|
||||
luxe / dev / parcel / entry parcel generated in 25.35105199785903ms
|
||||
luxe / dev / compiler / compiling dev content to `_luxe.data/` ...
|
||||
luxe / dev / compiler / luxe runtime path `/Users/jonathan/.luxe/modules/luxe/1.0.0-dev.84` ...
|
||||
luxe / dev / parcel / entry parcel generated in 13.84982001036406ms
|
||||
luxe / dev / compiler / compiling dev content to `.luxe/` ...
|
||||
luxe / dev / compiler / luxe runtime `2020.3.0` at path `/Users/jonathan/.luxe/modules/luxe/2020.3.0` ...
|
||||
+ modifier - 0 found
|
||||
+ block - 0 found
|
||||
+ material - 8 found
|
||||
+ material - 12 found
|
||||
+ shaders - 1 found
|
||||
+ particles - 0 found
|
||||
+ settings - 1 found
|
||||
+ script - 99 found
|
||||
- `.luxe/entry.settings.lx` > `.luxe/.luxe/entry.settings.lx.814a19b5`
|
||||
+ script - 109 found
|
||||
- parsing 1 scripts and their imports ...
|
||||
- parsing `game.wren` - 25.7934ms
|
||||
- parsing `random` - 0.00205ms
|
||||
- parsing `game.wren` - 4.76327ms
|
||||
- compiling 1 scripts ...
|
||||
- parsing `luxe: input` - 294.75053ms
|
||||
- parsing `luxe: io` - 5.14726ms
|
||||
- parsing `luxe/io` - 0.00207ms
|
||||
- parsing `luxe: assets` - 43.29227ms
|
||||
- compiled `game.wren` - 466.89295ms
|
||||
- parsing `luxe: input` - 288.53514ms
|
||||
- parsing `luxe: io` - 5.19695ms
|
||||
- parsing `luxe/io` - 0.00157ms
|
||||
- parsing `luxe: assets` - 46.15239ms
|
||||
- compiled `game.wren` - 352.31519ms
|
||||
+ render - 1 found
|
||||
+ tiles - 0 found
|
||||
+ font - 2 found
|
||||
+ anim - 0 found
|
||||
+ scene - 1 found
|
||||
- scene `game.scene` > `_luxe.data/game.3aa443a9.scene`
|
||||
- 1 layer/s, 1 need to compile
|
||||
- layer - game.scene/game > _luxe.data/game.scene/game.7950e0e7.layer
|
||||
- 0 entities, 0 modifier types
|
||||
- 0 total modifier instances
|
||||
+ material_basis - 11 found
|
||||
+ scene - 0 found
|
||||
+ material_basis - 13 found
|
||||
+ material_input - 0 found
|
||||
+ prototype - 0 found
|
||||
+ image - 6 found
|
||||
+ input - 1 found
|
||||
+ mesh - 0 found
|
||||
+ ui - 22 found
|
||||
luxe / dev / data compile times:
|
||||
- / material / spent `6.59513ms`
|
||||
- / shaders / spent `1.77217ms`
|
||||
- / font / spent `3.80225ms`
|
||||
- / scene / spent `14.39891ms`
|
||||
- / material_basis / spent `5.68039ms`
|
||||
- / settings / spent `0.71385ms`
|
||||
- / script / spent `1032.73059ms`
|
||||
- / image / spent `5.9489ms`
|
||||
- / input / spent `0.89094ms`
|
||||
- / render / spent `1.55595ms`
|
||||
- / ui / spent `10.18119ms`
|
||||
luxe / dev / compiler / compile complete | `153 assets` | `1088.274174006074ms`
|
||||
- / material / spent `3.0556ms`
|
||||
- / shaders / spent `5.32095ms`
|
||||
- / font / spent `4.19432ms`
|
||||
- / material_basis / spent `1.2656ms`
|
||||
- / settings / spent `0.99964ms`
|
||||
- / script / spent `396.45123ms`
|
||||
- / image / spent `4.22433ms`
|
||||
- / input / spent `0.59868ms`
|
||||
- / render / spent `0.49942ms`
|
||||
- / ui / spent `2.76114ms`
|
||||
luxe / dev / compiler / compile complete | `168 assets` | `421.0298489779234ms`
|
||||
luxe / project / info:
|
||||
- name: space
|
||||
- version: 0.0.1
|
||||
- package: com.luxeengine.game
|
||||
- entry: game
|
||||
- renderer: outline/renderer
|
||||
- settings: outline/settings
|
||||
- name: `space`
|
||||
- version: `0.0.1`
|
||||
- package: `com.luxeengine.game`
|
||||
- entry: `game`
|
||||
- renderer: `outline/renderer`
|
||||
- settings: `outline/settings`
|
||||
- depends:
|
||||
- luxe @ 1.0.0-dev.84
|
||||
- luxe @ 2020.3.0
|
||||
|
||||
luxe / sdl / 2.0.9 hg-12373:8feb5da6f2fb
|
||||
luxe / assets / settings / applied `outline/settings`
|
||||
|
|
@ -72,37 +72,43 @@ luxe / opengl / initializing
|
|||
luxe / opengl / request / 2x antialiasing (engine.render.antialiasing)
|
||||
luxe / opengl / request / core context (engine.render.opengl.core)
|
||||
luxe / opengl / request / 3.3 (engine.render.opengl.major/minor)
|
||||
luxe / opengl / versions / GL `4.1 INTEL-14.2.16` - GLSL `4.10`
|
||||
luxe / opengl / versions / GL `4.1 INTEL-14.7.8` - GLSL `4.10`
|
||||
luxe / opengl / request / debug logging (engine.render.opengl.debug_level = 3)
|
||||
luxe / render / init ok
|
||||
luxe / assets / loading `entry parcel` ...
|
||||
luxe / assets / loading / render data `luxe: render_data`
|
||||
luxe / assets / loading / shaders `luxe: shaders`
|
||||
luxe / assets / loading / basis `luxe: material_basis/font` 3777439469
|
||||
luxe / assets / loading / basis `luxe: material_basis/line` 1956587066
|
||||
luxe / assets / loading / basis `luxe: material_basis/mesh_solid` 2990521889
|
||||
luxe / assets / loading / basis `luxe: material_basis/solid` 1519506903
|
||||
luxe / assets / loading / basis `luxe: material_basis/sprite` 3941839433
|
||||
luxe / assets / loading / basis `luxe: material_basis/sprite_pixelated` 2606480210
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_font` 3033324030
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_mask` 1781843443
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_mask_root` 2267721108
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_solid` 1723021186
|
||||
luxe / assets / loading / basis `luxe: material_basis/wire` 358309301
|
||||
luxe / assets / loading / image `luxe: image/logo`
|
||||
luxe / assets / loading / image `luxe: image/logo.sprite`
|
||||
luxe / assets / loading / image `image/asteroid`
|
||||
luxe / assets / loading / image `image/laser`
|
||||
luxe / assets / loading / image `image/ship`
|
||||
luxe / assets / loading / image `image/star`
|
||||
luxe / assets / loading / basis `luxe: material_basis/font` 3777439469
|
||||
luxe / assets / loading / basis `luxe: material_basis/line` 1956587066
|
||||
luxe / assets / loading / basis `luxe: material_basis/mesh_debug` 538330473
|
||||
luxe / assets / loading / basis `luxe: material_basis/mesh_line` 4102261780
|
||||
luxe / assets / loading / basis `luxe: material_basis/mesh_solid` 2990521889
|
||||
luxe / assets / loading / basis `luxe: material_basis/solid` 1519506903
|
||||
luxe / assets / loading / basis `luxe: material_basis/sprite` 3941839433
|
||||
luxe / assets / loading / basis `luxe: material_basis/sprite_pixelated` 2606480210
|
||||
luxe / assets / loading / basis `luxe: material_basis/sprite_solid` 4167178021
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_font` 3033324030
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_mask` 1781843443
|
||||
luxe / assets / loading / basis `luxe: material_basis/ui_solid` 1723021186
|
||||
luxe / assets / loading / basis `luxe: material_basis/wire` 358309301
|
||||
luxe / assets / loading / font `luxe: fonts/lato` 702255734
|
||||
luxe / assets / loading / font `fonts/lato` 922558320
|
||||
luxe / assets / loading / material `luxe: material/font`
|
||||
luxe / assets / loading / material `luxe: material/logo`
|
||||
luxe / assets / loading / material `luxe: material/logo.sprite`
|
||||
luxe / assets / loading / material `luxe: material/mesh.debug`
|
||||
luxe / assets / loading / material `luxe: material/mesh.line`
|
||||
luxe / assets / loading / material `luxe: material/mesh_solid`
|
||||
luxe / assets / loading / material `luxe: material/solid`
|
||||
luxe / assets / loading / material `luxe: material/sprite.solid`
|
||||
luxe / assets / loading / material `material/asteroid`
|
||||
luxe / assets / loading / material `material/laser`
|
||||
luxe / assets / loading / material `material/ship`
|
||||
luxe / assets / loading / material `material/star`
|
||||
luxe / assets / loading / bytes `luxe: anim/material.track.lx`
|
||||
|
|
@ -112,8 +118,6 @@ luxe / assets / loading `entry parcel` ...
|
|||
luxe / assets / loading / bytes `_art/laser.ase`
|
||||
luxe / assets / loading / bytes `_art/player_ship.ase`
|
||||
luxe / assets / loading / bytes `_art/star.ase`
|
||||
luxe / assets / loading / bytes `empty.outline.lx`
|
||||
luxe / assets / loading / scene `game`
|
||||
luxe / assets / loading / input `outline/inputs`
|
||||
luxe / assets / loading / ui `luxe: ui/editor.mini.anim.sprite.key`
|
||||
luxe / assets / loading / ui `luxe: ui/editor.panel.button`
|
||||
|
|
@ -137,7 +141,9 @@ luxe / assets / loading `entry parcel` ...
|
|||
luxe / assets / loading / ui `luxe: ui/editor.panel.progress`
|
||||
luxe / assets / loading / ui `luxe: ui/editor.panel.slider`
|
||||
luxe / assets / loading / ui `luxe: ui/editor.panel.text`
|
||||
luxe / assets / loaded `entry parcel` with `61 items` in `36.74460700131021ms`
|
||||
luxe / assets / loaded `entry parcel` with `65 items` in `28.37803307920694ms`
|
||||
luxe / runtime / setting log level `info`
|
||||
luxe / assets / input / loading entry input `outline/inputs`
|
||||
luxe / render / init renderer script `outline/renderer`
|
||||
game / render / init / ok
|
||||
ready!
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
material = {
|
||||
basis = "luxe: material_basis/sprite_pixelated"
|
||||
samplers = { 0 = "image/asteroid" }
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
material = {
|
||||
basis = "luxe: material_basis/sprite_pixelated"
|
||||
samplers = { 0 = "image/ship" }
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
material = {
|
||||
basis = "luxe: material_basis/sprite_pixelated"
|
||||
samplers = { 0 = "image/star" }
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import "luxe: world" for World, Camera, Entity, Transform
|
||||
import "luxe: render" for Render
|
||||
import "luxe: game" for Frame
|
||||
|
||||
class App {
|
||||
|
||||
|
|
@ -30,10 +31,26 @@ class App {
|
|||
_camera = Entity.create(_world, "app.camera")
|
||||
Transform.create(_camera)
|
||||
Camera.create(_camera)
|
||||
Camera.set_default(_world, _camera)
|
||||
|
||||
_ui_camera = Entity.create(_ui_world, "app.ui_camera")
|
||||
Transform.create(_ui_camera)
|
||||
Camera.create(_ui_camera)
|
||||
Camera.set_default(_ui_world, _ui_camera)
|
||||
|
||||
//update our worlds
|
||||
|
||||
Frame.on(Frame.sim) {|delta|
|
||||
World.tick(_world, delta)
|
||||
World.tick(_ui_world, delta)
|
||||
}
|
||||
|
||||
//render our worlds
|
||||
|
||||
Frame.on(Frame.visual) {|delta|
|
||||
World.render(_world, _camera, "game", {"clear_color":_color})
|
||||
World.render(_ui_world, _ui_camera, "ui")
|
||||
}
|
||||
|
||||
} //new
|
||||
|
||||
|
|
@ -54,21 +71,4 @@ class App {
|
|||
|
||||
} //destroy
|
||||
|
||||
tick(delta) {
|
||||
|
||||
//update worlds
|
||||
|
||||
World.tick_systems(_world, delta)
|
||||
World.tick_systems(_ui_world, delta)
|
||||
|
||||
World.tick_world(_world, delta)
|
||||
World.tick_world(_ui_world, delta)
|
||||
|
||||
//render worlds
|
||||
|
||||
World.render(_world, _camera, "game", {"clear_color":_color})
|
||||
World.render(_ui_world, _ui_camera, "ui")
|
||||
|
||||
} //tick
|
||||
|
||||
} //
|
||||
|
|
|
|||
|
|
@ -3,4 +3,21 @@ input = {
|
|||
{ name = "ui" where = "front" channels = ["c01"] }
|
||||
{ name = "game" where = "after: ui" channels = ["c02"] }
|
||||
]
|
||||
|
||||
map = {
|
||||
left = { keys = ["key_a", "left"] }
|
||||
right = { keys = ["key_d", "right"] }
|
||||
up = { keys = ["key_w", "up"] }
|
||||
down = { keys = ["key_s", "down"] }
|
||||
jump = {
|
||||
keys = ["key_x", "up", "key_w", "space"]
|
||||
mouse = ["left"]
|
||||
gamepad = [0]
|
||||
}
|
||||
|
||||
next = {
|
||||
keys = ["key_x", "up", "key_w", "space", "enter", "escape"]
|
||||
mouse = ["left", "right"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,4 @@ class Renderer {
|
|||
|
||||
} //ui_render_path
|
||||
|
||||
} //Renderer
|
||||
} //Renderer
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
engine = {
|
||||
input.entry = "outline/inputs"
|
||||
runtime = {
|
||||
window = {
|
||||
width = 960
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
// luxe 1.0.0-dev.84
|
||||
import "luxe: project" for Entry
|
||||
|
||||
import "luxe: project" for Project
|
||||
class Project is Entry {
|
||||
|
||||
class project is Project {
|
||||
|
||||
construct new(target) {
|
||||
construct entry(target) {
|
||||
|
||||
name = "space"
|
||||
version = "0.0.1"
|
||||
|
|
|
|||
Loading…
Reference in a new issue