3d
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
|
||||
FX :: struct {
|
||||
using base: BaseEntity,
|
||||
parent: Handle,
|
||||
lifetime: f32,
|
||||
permanent: bool,
|
||||
}
|
||||
|
||||
init_fx :: proc(state: ^GameState, fx: FX) -> Handle {
|
||||
return spawn(state, Entity{v = fx})
|
||||
}
|
||||
|
||||
fx_update :: proc(state: ^GameState, fx: ^FX, h: Handle, dt: f32) {
|
||||
if fx.parent != {} {
|
||||
if pe := get_entity(state, fx.parent); pe != nil {
|
||||
fx.pos = get_base(pe).pos
|
||||
} else {
|
||||
fx.marked = true
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if !fx.permanent {
|
||||
if fx.lifetime > 0 {
|
||||
fx.lifetime -= dt
|
||||
} else {
|
||||
fx.marked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user