-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new system that couple of targets will be set and fireflies will go to target(s)
- Loading branch information
Showing
10 changed files
with
317 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Target { | ||
x: number | ||
y: number | ||
affectedFireflies: FireFly[] | ||
|
||
constructor(x: number, y: number, affectedFireflies: FireFly[]) { | ||
this.x = x | ||
this.y = y | ||
this.affectedFireflies = affectedFireflies | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const targetConfig: TargetConfigType = { | ||
toggle: true, | ||
count: 1, | ||
followChance: 1, | ||
movementsTowardsTargetMode: "smooth", | ||
randomMovementChance: 1, | ||
targetResetTime_MS: 3000, | ||
targetPickingMethod: "nearest" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// modes of how a firefly should follow the target | ||
// smooth : it moves with angle toward the target | ||
// stiff: it moves based on the target's x and y position | ||
// random: like stiff but the x and directions are picked | ||
// one at a time on random | ||
type MovementsTowardsTargetModesType = "smooth" | "stiff" | "random" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// target is coordinates on the canvas that | ||
// (some) points | ||
type TargetConfigType = { | ||
// toggles whether the target feature is on or off | ||
toggle: boolean | ||
// how many targets are on the screen at once | ||
count: number | ||
// how long the target will stay on the screen | ||
// until it resets | ||
targetResetTime_MS: number | ||
// likelihood that a firefly would follow | ||
// targets [0 - 1] | ||
followChance: number | ||
// movement towards the target (smooth, stiff, random) | ||
movementsTowardsTargetMode: MovementsTowardsTargetModesType | ||
// if movementsTowardsTargetMode: random, then how much will firefly | ||
// commit to move at all [0: won't move, 1: will totally move] | ||
randomMovementChance: number | ||
// How a target gets selected | ||
targetPickingMethod: TargetPickingMethodType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type TargetPickingMethodType = "nearest" | "farthest" | "random" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.