]> git.lizzy.rs Git - dungeon_game.git/blobdiff - plugins/fireball/fireball.c
Slightly randomize fireball color
[dungeon_game.git] / plugins / fireball / fireball.c
index 1c3eeb6e31d6ab4a0b239de61b4d6ee883a02fe9..3da29a47d9e025a8efed27dbdbc27a74be46e147 100644 (file)
@@ -15,6 +15,10 @@ static void fireball_spawn(struct entity *self, void *data)
 {
        self->meta = malloc(sizeof(struct fireball_data));
        *((struct fireball_data *) self->meta) = *((struct fireball_data *) data);
+
+       self->color.r = clamp(self->color.r + rand() % 65 - 32, 0, 255);
+       self->color.g = clamp(self->color.g + rand() % 65 - 32, 0, 255);
+       self->color.b = clamp(self->color.b + rand() % 65 - 32, 0, 255);
 }
 
 static void fireball_step(struct entity *self, struct entity_step_data stepdata)