This commit is contained in:
silva guimaraes 2025-08-23 19:53:45 -03:00
parent 2c2eaf9507
commit 730e697258

21
main.go
View file

@ -4,6 +4,8 @@ import (
"fmt"
"math"
"math/rand"
"slices"
rl "github.com/gen2brain/raylib-go/raylib"
)
@ -76,11 +78,16 @@ type emitter struct {
var city *scene
func update_emitters() {
for i, e := range city.emitters {
if remainingParticles := e.update(); remainingParticles == 0 {
city.emitters[i] = city.emitters[len(city.emitters)-1]
city.emitters = city.emitters[:len(city.emitters)-1]
for i := 0; i < len(city.emitters); i++ {
e := city.emitters[i]
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() {
const min = 10
for _, b := range city.buildings {
@ -318,7 +324,6 @@ func newBuilding(x, z float32) *building {
}
}
func drawWireframe(building building) {
increasedSize := rl.Vector3Scale(building.size, 1.05)
@ -367,7 +372,6 @@ func shakeBuilding(b *building) animationFunc {
}
}
func draw_buildings() {
for _, building := range city.buildings {
@ -466,7 +470,6 @@ func main() {
for !rl.WindowShouldClose() {
rl.UpdateCamera(&character.camera, rl.CameraFirstPerson)
rl.BeginDrawing()
rl.ClearBackground(rl.LightGray)
@ -483,8 +486,6 @@ func main() {
update_emitters()
// direction = rl.Vector3Subtract(
// character.camera.Target, character.camera.Position)
// aim = rl.Vector3Lerp(direction, aim, 0.95)