-
Notifications
You must be signed in to change notification settings - Fork 1
example
phil_stein edited this page Oct 23, 2021
·
1 revision
// import the diffent interfaces for the engine
extern var Entity;
extern var World;
extern var Game;
extern var Input;
extern var UI;
// variables, dynamically typed
var check;
var btn = false;
// called once at startup
func init()
{
System.print("hello, world");
}
// called every frame
func update()
{
// these vars expose the functions hooked into bee engine
var this = Entity();
var world = World();
var game = Game();
var input = Input();
var ui = UI();
// ---- code ----
var enemy = world.get_entity("enemy");
if (input.get_key_ENTER())
{
var speed = 2 * game.get_delta_t();
this.move_y(speed);
world.move_y(enemy, speed);
game.load_level("good_level");
}
// in game "immmediate mode ui", wrapper for nuklear ui
ui.begin();
if (ui.window_begin("in game nuklear ui", 900, 10, 300, 250))
{
ui.layout(25, 1);
if (ui.button("button"))
{
btn = !btn;
}
if (btn)
{
ui.layout(25, 2);
ui.text("checkbox describtion");
check01 = ui.checkbox("option a", check);
ui.layout(25, 1);
}
} ui.window_end();
ui.end();
}