more fixes

runs now
This commit is contained in:
Ronja 2021-02-09 09:44:12 +01:00
parent 7cc4875a10
commit 83b933f8a7
6 changed files with 22 additions and 8 deletions

View file

@ -3,6 +3,7 @@ import "globals" for Globals
import "luxe: containers" for Lists
import "math/observable" for Observable
import "math/vector" for Vector
import "math/util" for Util
class Human{
active{_active}
@ -36,11 +37,14 @@ class Human{
_name = "unnamed"
_adventure_count = 0
color = [1, 1, 1, 1]
_material = Util.material_from_image_path("assets/wip/Human")
}
show(){
_entity = Entity.create(Globals["Game"].app.world, name)
Transform.create(_entity)
Sprite.create(_entity, _material, 10, 12)
Sprite.set_color(_entity, _color.r, _color.g, _color.b, _color.a)
}
@ -50,8 +54,8 @@ class Human{
}
update(){
var index = __activeHumans.indexOf(this)
var pos = PlayerStart + PlayerSize / 2 + PlayerSize * index
var index = __activeHumans.value.indexOf(this)
var pos = PlayerStart + PlayerSize.y0() / 2 + PlayerSize.y0() * index
Transform.set_pos(_entity, pos.x, pos.y)
}

View file

@ -8,7 +8,7 @@ import "luxe: assets" for Assets
import "luxe: color" for Color
import "outline/app" for App
import "outline/Renderer" for Renderer
import "outline/renderer" for Renderer
import "blocks/ui/ui" for Ui
import "blocks/debug" for DrawDebug, Holder
import "globals" for Globals, RandomInst

View file

@ -98,4 +98,4 @@ class M{
import "math/vector" for Vector
import "luxe: math" for Math
import "math/repVal" for RepVal
import "math/Util" for Util
import "math/util" for Util

View file

@ -4,7 +4,7 @@ import "luxe: ui/control" for Control
import "luxe: world" for UIEvent, UI, Entity
import "math/math" for M
import "math/Vector" for Vector
import "math/vector" for Vector
import "math/rect" for AABB
class Util{

View file

@ -44,12 +44,22 @@ class Vector is Sequence{
_y = -_y
return this
}
x(new_x : Num) : Vector{
_x = new_x
return this
}
y(new_y : Num) : Vector{
_y = new_y
return this
}
static or_lt(one, other){
static or_lt(one, other) : Bool{
return one.x < other.x || one.y < other.y
}
static or_gt(one, other){
static or_gt(one, other) : Bool{
return one.x > other.x || one.y > other.y
}

View file

@ -2,7 +2,7 @@ import "luxe: world" for World, Camera, Entity, Transform
import "luxe: render" for Render
import "luxe: bytes" for Floats
import "outline/Renderer" for Renderer
import "outline/renderer" for Renderer
import "globals" for Globals
import "math/rect" for AABB