HexCardsClient/field.wren
2021-05-23 15:32:50 +02:00

36 lines
No EOL
1.1 KiB
Text

import "luxe: world" for Prototype, Entity
var Slots = [
[-1, +3, -2], [ 0, +2, -2], [ 1, +1, -2], [ 2, +0, -2], [ 3, -1, -2],
[-2, +3, -1], [-1, +2, -1], [ 0, +1, -1], [ 1, +0, -1], [ 2, -1, -1], [ 3, -2, -1],
[-3, +3, +0], [-2, +2, +0], [-1, +1, +0], [ 0, +0, +0], [ 1, -1, +0], [ 2, -2, +0], [ 3, -3, 0],
[-3, +2, +1], [-2, +1, +1], [-1, +0, +1], [ 0, -1, +1], [ 1, -2, +1], [ 2, -3, +1],
[-3, +1, +2], [-2, +0, +2], [-1, -1, +2], [ 0, -2, +2], [ 1, -3, +2]
]
var x_angle = 1 * Num.tau / 12
var y_angle = 5 * Num.tau / 12
var z_angle = 9 * Num.tau / 12
var X_Dir = [x_angle.cos, x_angle.sin, 0]
var Y_Dir = [y_angle.cos, y_angle.sin, 0]
var Z_Dir = [z_angle.cos, z_angle.sin, 0]
class Field{
construct new(world){
_world = world
_root = Entity.create(world)
_slots = []
}
add_slot(slot: List /*of Num*/){
Prototype.create(_world, "prototype/card", "card(%(slot.x), %(slot.y), %(slot.z))", [0, 0, 0], [0,0,0], [2,2,2])
}
add_slots(slots: List /*of List of Num*/){
for(slot in slots){
add_slot(slot)
}
}
}