Skip to content

Commit

Permalink
Support gradient fill in Shape material
Browse files Browse the repository at this point in the history
  • Loading branch information
makscee committed Mar 9, 2024
1 parent 947082d commit 82d0a25
Show file tree
Hide file tree
Showing 32 changed files with 209 additions and 284 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spacetimedb-sdk = "0.8.1"
bevy = { version = "0.11.0", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",

"bevy_winit",
"multi-threaded",
"filesystem_watcher",
"bevy_ui",
Expand Down
156 changes: 6 additions & 150 deletions assets/ron/custom.battle.ron
Original file line number Diff line number Diff line change
Expand Up @@ -8,127 +8,31 @@
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
(
name: "Wizard",
hp: 3,
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
(
name: "Wizard",
hp: 3,
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
(
name: "Wizard",
hp: 3,
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
],
),
Expand All @@ -141,63 +45,15 @@
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
(
name: "Wizard",
hp: 3,
atk: 1,
houses: "Mages",
trigger: Fire(trigger: TurnEnd, target: RandomEnemy, effect: UseAbility("Magic Missile")),
representation: (
material: Shape(
shape: Circle,
thickness: Sum(Float(2.5), Cos(GameTime)),
size: Vec2E(Sum(Float(0.7), Mul(Beat, Float(0.3)))),
),
children: [
(
count: 5,
material: Shape(shape: Circle, fill: Opaque, size: Vec2E(Float(0.2))),
mapping: {
Offset: Mul(
Vec2EE(
Sin(Sum(GameTime, IntFloat(State(Index)))),
Cos(GameTime),
),
Mul(
Cos(Mul(Sum(GameTime, IntFloat(State(Index))), Float(1.3))),
Sum(Float(0.5), Beat),
),
),
},
),
],
),

),
],
),
Expand Down
1 change: 0 additions & 1 deletion assets/ron/heroes/bolla.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
size: Vec2E(Float(0.5)),
thickness: Float(1.0),
alpha: Float(0.2),
color: State(Color),
),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/crusader.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
size: Vec2(0.5, 1.82),
thickness: Float(3.0),
alpha: Float(0.3),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/equalizer.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
size: Vec2E(Float(1.5)),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/fertilizer.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
size: Vec2E(Float(1.0)),
thickness: Float(2.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/guardian.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
size: Vec2E(Float(0.8)),
thickness: Float(0.6),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/hag.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Sin(Sum(GameTime, Mul(Index, Float(0.1)))),
),
aa: Float(0.5),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/henchman.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {Offset: Mul(UnitVec(Mul(GameTime, Float(100.0))), Float(0.05))},
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/inciter.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
),
thickness: Float(1.0),
alpha: Float(0.3),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/mentalist.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
size: Vec2E(Float(0.25)),
thickness: Float(1.3),
alpha: If(Equals(State(Index), Zero), Float(0.6), Float(0.1)),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/mesmerist.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
size: Vec2E(Mul(Index, Mul(Float(0.1), Abs(Sin(Sum(GameTime, Index)))))),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {},
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/protector.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
size: Vec2E(Float(0.67)),
thickness: Float(0.37),
alpha: Float(0.36),
color: State(Color),

),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/heroes/ritualist.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
size: Vec2E(Float(0.5)),
thickness: Float(2.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {
Expand Down
1 change: 0 additions & 1 deletion assets/ron/heroes/scavenger.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
size: Vec2E(Sum(Float(0.4), Mul(RandomFloat, Float(1.1)))),
thickness: Sum(Float(0.8), Mul(RandomFloat, Float(3.0))),
alpha: Float(0.2),
color: State(Color),
),
children: [],
mapping: {Rotation: Sum(IntFloat(State(Index)), Sin(Sum(GameTime, Mul(RandomFloat, Float(10.0)))))},
Expand Down
1 change: 0 additions & 1 deletion assets/ron/heroes/trimmer.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
size: Vec2(1.0, 1.0),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),
),
children: [],
mapping: {
Expand Down
1 change: 0 additions & 1 deletion assets/ron/heroes/victim.unit.ron
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
size: Vec2E(Sum(Float(0.2), Sub(Zero, Mul(Index, Float(0.03))))),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),
),
children: [],
mapping: {
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/houses/paladins.house.ron
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {},
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/houses/warlocks.house.ron
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
),
thickness: Float(1.0),
alpha: Float(1.0),
color: State(Color),

),
children: [],
mapping: {Offset: Mul(UnitVec(Mul(Sin(Sum(GameTime, Index)), Float(100.0))), Float(0.05))},
Expand Down
2 changes: 1 addition & 1 deletion assets/ron/slot.rep.ron
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(material: Shape(shape: Rectangle, color: Hex("#03A9F4"), size: Vec2E(Float(2.6))))
(material: Shape(shape: Rectangle, colors: [Hex("#03A9F4")], size: Vec2E(Float(2.6))))
2 changes: 1 addition & 1 deletion assets/ron/status.rep.ron
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(
material: Shape(
shape: Circle,
color: State(Color),

size: Vec2E(Sum(Float(1.25), Mul(IntFloat(State(Index)), Float(0.1)))),
),
)
6 changes: 3 additions & 3 deletions assets/ron/unit.rep.ron
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
material: Shape(
shape: Circle,
size: Vec2E(Sum(Mul(If(Even(State(Slot)), Beat, Mul(Beat, Float(-1.0))), Float(0.1)), Float(1.0))),
color: Hex("#B0BEC5"),
colors: [Hex("#B0BEC5")],
),
children: [
(
material: Shape(shape: Circle, color: Hex("#FF3D00"), size: Vec2E(Float(0.3))),
material: Shape(shape: Circle, colors: [Hex("#FF3D00")], size: Vec2E(Float(0.3))),
mapping: {Offset: Vec2(0.9, -0.9)},
children: [(material: Text(text: StringInt(State(Hp)), size: Float(0.6), color: Hex("#FF3D00")))],
),
(
material: Shape(shape: Circle, color: Hex("#FBC02D"), size: Vec2E(Float(0.3))),
material: Shape(shape: Circle, colors: [Hex("#FBC02D")], size: Vec2E(Float(0.3))),
mapping: {Offset: Vec2(-0.9, -0.9)},
children: [(material: Text(text: StringInt(State(Atk)), size: Float(0.6), color: Hex("#FBC02D")))],
),
Expand Down
Loading

0 comments on commit 82d0a25

Please sign in to comment.