Conversation
examples/2d/move_sprite.rs
Outdated
| } | ||
|
|
||
| struct BevyLogo { | ||
| rising: bool, |
There was a problem hiding this comment.
We should use an enum for this.
There was a problem hiding this comment.
I'm a bit new to rust and bevy ECS. can you explain why?
There was a problem hiding this comment.
Rust enums provide an extra level of type safety and you can also name the variants to be more descriptive.
effectively
enum Movement {
Rising,
Falling
}and
boolare equivalent.
However the Movement enum is more descriptive as to what the two states actually represent.
There was a problem hiding this comment.
Especially if you call it something amusing like
Logomotion
alice-i-cecile
left a comment
There was a problem hiding this comment.
Simple, does what it says on the tin. Probably useful enough to beginners to be worth including.
| .spawn_bundle(SpriteBundle { | ||
| material: materials.add(texture_handle.into()), | ||
| ..Default::default() | ||
| }) |
There was a problem hiding this comment.
could you add a transform component to show how to place a sprite from the start?
examples/2d/move_sprite.rs
Outdated
| App::build() | ||
| .add_plugins(DefaultPlugins) | ||
| .add_startup_system(setup.system()) | ||
| .add_system(sprite_movement.system()) |
There was a problem hiding this comment.
on main the .system() syntax is no longer needed.
So we should probably also remove it here :)
There was a problem hiding this comment.
it can be done later, we will need a big pass on all examples anyway
Co-authored-by: Nathan Ward <43621845+NathanSWard@users.noreply.github.com>
fixed line endings added space for CI changed to enum fixed formating fix formating again added transform to start. removed system
33a87b4 to
68e1a20
Compare
|
okay I messed up trying to update my branch so that optional system was implemented. Can someone help? |
If you can find the previous commit (before updating to main, reset to that branch) Then when you update to main you want to rebase onto it. My remote repo for bevy (not my personal fork) is aliased as It looks like the old commit hash you want is |
|
I just decided to redo the pull request since I seemed to mess it up more :( #2414 |
Objective
There is no bevy example that shows how to transform a sprite. At least as its singular purpose. This creates an example of how to use transform.translate to move a sprite up and down.
Solution
I created move_sprite example.