block strings dont work

This commit is contained in:
Ronja 2020-09-04 14:44:45 +02:00
parent 0744070143
commit 10da4eb456
3 changed files with 32 additions and 2 deletions

21
Luxe/assets/names.lx Normal file
View file

@ -0,0 +1,21 @@
names = [
//todo: make more sophisticated to allow first + last name relationships, make common matches for those,
//make groups based on origin culture / meaning
//probably better to do when I have a procgen text engine
"Bob",
"Steve",
"Sven",
"Ronja",
"Amelia",
"Chloe",
"Lauren",
"Innes",
"Rami",
"Mao",
"Richard",
"Jules",
"Mercedes",
"Karl",
"Lara"
]

View file

@ -20,6 +20,12 @@ class Human {
Sprite.set_color(entity, color.r, color.g, color.b, color.a)
}
}
static set_name(entity, name){
var data = Modifiers.get(This, entity)
var id = Strings.add(name)
System.print("Setting name of %(entity) to %(name) via string id of %(id).")
//data.name = id
}
} //Human

View file

@ -1,10 +1,10 @@
import "luxe: game" for Game
import "luxe: assets" for Assets
import "luxe: input" for Input, Key
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera
import "luxe: math" for Math
import "luxe: draw" for Draw
import "luxe: io" for IO
import "luxe: assets" for Assets
import "luxe: color" for Color
import "outline/app" for App
@ -86,9 +86,12 @@ class game is Game {
create_human(){
var human = Entity.create(app.world, "human")
var humanMat = Util.material_from_image_path("assets/wip/Human")
Human.create(human)
Human.set_color(human, Util.hsv(RandomInst.float(), 0.5, 1))
var names = Assets.lx("assets/names.lx")["names"]
var name = names[RandomInst.int(0, names.count)]
Human.set_name(human, name)
}
app { _app }