Sprite rendering is done using WEBGPU. Supports sprite strip animation.
bevy-wgpu-2d's Introduction
bevy-wgpu-2d's People
bevy-wgpu-2d's Issues
Jump
Design/implement file format for assets
Currently we load sprite data by specifying the anim timeline, anim strips and views like so:
let player_sprite = sprite_registry.insert(SpriteData::load_from_anim_strips(
"player",
vec!["assets/huntress/idle.png", "assets/huntress/run.png", "assets/huntress/attack1.png"],
View {
x: 55,
y: 53,
width: 40,
height: 50,
},
));
...
let anim_timeline = load_anim_timeline("assets/huntress/keyframes.json");
All of this information can be moved to a file. It doesn't make sense to load the anim_timeline
from a seperate file from the View
and anim strip list.
The new API would be a lot simpler:
let animated_player_sprite = sprite_registry.insert(SpriteData::load_from_file("assets/huntress.json")
where "huntress.json"
contains all the information.
current_frame takes in redundant argument strip
pub fn current_frame(&self, strip: Range<usize>, length: f32, elapsed: f32) -> u8 {
let dt = elapsed % length;
let mut frame = 0;
for f in self.0[strip].iter().rev() {
if dt > f.time {
frame = f.index;
break;
}
}
frame
}
If we reformat our how our animation keyframes are stored, we don't need to supply frame ranges (strip) to specify which animation
`current_frame()` takes in redundant argument `length`
pub fn current_frame(&self, strip: Range<usize>, length: f32, elapsed: f32) -> u8 {
let dt = elapsed % length;
let mut frame = 0;
for f in self.0[strip].iter().rev() {
if dt > f.time {
frame = f.index;
break;
}
}
frame
}
length is the last value in strip. does not need to be passed as an arg. extract length from strip.last or something
Attack
Run left
Currently we only play the run right animation for running both left and right.
Flip the sprite when running left
Colliders should be bound to sprite "bones"
One press of attack button sometimes plays two attack animations
Audio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.