walk until I find an undescribed crash

This commit is contained in:
Ronja 2021-02-09 20:25:36 +01:00
parent 10e74c620d
commit 10b50c1089
3 changed files with 31 additions and 3 deletions

View file

@ -1,6 +1,9 @@
import "luxe: world" for Entity, Transform, Sprite
import "globals" for Globals
import "luxe: containers" for Lists
import "luxe: assets" for Strings
import "luxe: input" for Input, MouseButton
import "globals" for Globals
import "math/observable" for Observable
import "math/vector" for Vector
import "math/util" for Util
@ -62,6 +65,29 @@ class Human{
dispose(){
active = false
}
static tick(){
var mouse = Globals["GameMouse"]
__activeHumans.value.each(){|human|
var entity = human.entity
var over = Sprite.contains(entity, mouse.x, mouse.y)
if(over && __hoverEnt != entity){
__hoverEnt = entity
Globals["Tooltip"].set(Strings.get(human.name), entity)
}
if(!over && __hoverEnt == entity){
__hoverEnt = null
Globals["Tooltip"].clear(entity)
}
if(Input.mouse_state_pressed(MouseButton.left)){
var game = Globals["Game"]
if(__hoverEnt){ //remove if statement to allow clicking away (probably needs extra code to allow ui clicking)
game.focus.value = __hoverEnt
}
}
}
}
}
var PlayerStart:Vector = Vector.new(26, 89)

View file

@ -1,10 +1,11 @@
import "luxe: io" for IO
import "luxe: world" for World, Entity, Modifiers, ModifierSystem, Transform, Sprite
import "luxe: assets" for Strings
import "luxe: input" for Input, MouseButton
import "math/vector" for Vector
import "math/util" for Util
import "globals" for Globals
import "luxe: assets" for Strings
import "luxe: input" for Input, MouseButton
//User facing API
//This is what the user of your modifier will interact with

View file

@ -57,6 +57,7 @@ class Game is Ready {
DrawDebug.commit()
_tooltip.tick()
_adventures.tick()
Human.tick()
app.tick(delta)