Commit
This commit is contained in:
parent
2c2eaf9507
commit
730e697258
1 changed files with 336 additions and 335 deletions
21
main.go
21
main.go
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"slices"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "github.com/gen2brain/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -76,11 +78,16 @@ type emitter struct {
|
||||||
var city *scene
|
var city *scene
|
||||||
|
|
||||||
func update_emitters() {
|
func update_emitters() {
|
||||||
for i, e := range city.emitters {
|
for i := 0; i < len(city.emitters); i++ {
|
||||||
if remainingParticles := e.update(); remainingParticles == 0 {
|
|
||||||
city.emitters[i] = city.emitters[len(city.emitters)-1]
|
e := city.emitters[i]
|
||||||
city.emitters = city.emitters[:len(city.emitters)-1]
|
remainingParticles := e.update()
|
||||||
|
|
||||||
|
if remainingParticles == 0 {
|
||||||
|
city.emitters = slices.Delete(city.emitters, i, i+1)
|
||||||
|
i--
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +175,6 @@ func update_projectiles() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (c *character) kill_aurea() {
|
func (c *character) kill_aurea() {
|
||||||
const min = 10
|
const min = 10
|
||||||
for _, b := range city.buildings {
|
for _, b := range city.buildings {
|
||||||
|
|
@ -318,7 +324,6 @@ func newBuilding(x, z float32) *building {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func drawWireframe(building building) {
|
func drawWireframe(building building) {
|
||||||
increasedSize := rl.Vector3Scale(building.size, 1.05)
|
increasedSize := rl.Vector3Scale(building.size, 1.05)
|
||||||
|
|
||||||
|
|
@ -367,7 +372,6 @@ func shakeBuilding(b *building) animationFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func draw_buildings() {
|
func draw_buildings() {
|
||||||
for _, building := range city.buildings {
|
for _, building := range city.buildings {
|
||||||
|
|
||||||
|
|
@ -466,7 +470,6 @@ func main() {
|
||||||
|
|
||||||
for !rl.WindowShouldClose() {
|
for !rl.WindowShouldClose() {
|
||||||
|
|
||||||
|
|
||||||
rl.UpdateCamera(&character.camera, rl.CameraFirstPerson)
|
rl.UpdateCamera(&character.camera, rl.CameraFirstPerson)
|
||||||
rl.BeginDrawing()
|
rl.BeginDrawing()
|
||||||
rl.ClearBackground(rl.LightGray)
|
rl.ClearBackground(rl.LightGray)
|
||||||
|
|
@ -483,8 +486,6 @@ func main() {
|
||||||
|
|
||||||
update_emitters()
|
update_emitters()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// direction = rl.Vector3Subtract(
|
// direction = rl.Vector3Subtract(
|
||||||
// character.camera.Target, character.camera.Position)
|
// character.camera.Target, character.camera.Position)
|
||||||
// aim = rl.Vector3Lerp(direction, aim, 0.95)
|
// aim = rl.Vector3Lerp(direction, aim, 0.95)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue