From 10da4eb456c9b53f056dfe80ca8cd83596d271e1 Mon Sep 17 00:00:00 2001 From: Ronja Date: Fri, 4 Sep 2020 14:44:45 +0200 Subject: [PATCH] block strings dont work --- Luxe/assets/names.lx | 21 +++++++++++++++++++++ Luxe/blocks/human/human.wren | 6 ++++++ Luxe/game.wren | 7 +++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Luxe/assets/names.lx diff --git a/Luxe/assets/names.lx b/Luxe/assets/names.lx new file mode 100644 index 0000000..560e2a6 --- /dev/null +++ b/Luxe/assets/names.lx @@ -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" +] \ No newline at end of file diff --git a/Luxe/blocks/human/human.wren b/Luxe/blocks/human/human.wren index f8aaa09..a283669 100644 --- a/Luxe/blocks/human/human.wren +++ b/Luxe/blocks/human/human.wren @@ -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 diff --git a/Luxe/game.wren b/Luxe/game.wren index 9b13677..c20d626 100644 --- a/Luxe/game.wren +++ b/Luxe/game.wren @@ -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 }