-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05920d9
commit 8a951ff
Showing
5 changed files
with
85 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
const std = @import("std"); | ||
const raylib = @import("raylib"); | ||
const Shared = @import("../Shared.zig").Shared; | ||
|
||
pub const MeteorSprite = Shared.Sprite.init(5, .Meteor); | ||
|
||
pub const Meteor = struct { | ||
position: raylib.Vector2, | ||
speed: raylib.Vector2, | ||
radius: f32, | ||
rotation: f32, | ||
active: bool, | ||
color: raylib.Color, | ||
frame: f32, | ||
|
||
pub fn Draw(self: @This()) void { | ||
const spriteFrame = MeteorSprite.getSpriteFrame(@intFromFloat(self.frame)); | ||
const color: raylib.Color = if (self.active) self.color else raylib.Color.fade(self.color, 0.3); | ||
|
||
raylib.drawTextureNPatch( | ||
spriteFrame.Texture, | ||
spriteFrame.NPatchInfo, | ||
raylib.Rectangle.init( | ||
self.position.x, | ||
self.position.y, | ||
self.radius * 2, | ||
self.radius * 2, | ||
), | ||
raylib.Vector2.init( | ||
self.radius, | ||
self.radius, | ||
), | ||
self.rotation * 365, | ||
color, | ||
); | ||
} | ||
}; |
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
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