This is my first bevy game and i want to get some feedback on my code and ways i could improve
#Please review my Flappy Bird clone
61 messages · Page 1 of 1 (latest)
will do
.despawn_descendants().despawn();
here in the main_meu exist system could just use .despawn_recursive()
look a little nicer
i used that also in the game::exit i think
ah okay tiny thing anywys
adding the default plugins and window config in the GamePlugin is a bit weird though
especially since winit settting are done in main.rs as well
thats because i started with game.rs as my main and moved it to a different file after i started working on the main menu
should've moved the plugins to main.rs
ah okay
its nothing bad anyways
fn delete_offscreen_entities(
entities: Query<(Entity, &Transform), Without<Bird>>,
the Without<Bird> seems very useless since the bird will never be affected anways
i wanted to be careful
i feel like using rapier CollisionEvents might be an easier and more practical way of doing the collision detection work (just a suggestion, i never used rapier myself before)
a small thing would also be that if a module (for example main_meu) contains only one file it should simply be a file (so instead of main_menu/mod.rs just do main_menul.rs)
the cloud_spawn system is a bit hard to read
not super horrible though
fair enough
Small thing but changing
#[derive(Resource)]
pub struct Score(u32);
to
#[derive(Resource, Deref, DerefMut)]
pub struct Score(u32);
would allow you to change score.0 += 1; to score += 1; iirc
that is very useful to know
true
tbh i also forgot about Deref and DerefMut
All in all its pretty good
well organised code imo
Yea looking good
cool
To me it seems a bit odd that bird_pipe_collide also increases the score
I named my scoring system just scoring_system afaik
or just scoring
yea i should’ve moved the scoring into another function
oh another little thing to keep in mind for bigger projects
using time.delta_seconds() can be a really bad idea
usualy you should cap it
so for example time.delta_seconds().min(1.0)
here it doesn't matter though
im guessing thats to avoid an overflow
nope
the problem comes down to when lag happens
if you use time.delta_seconds() there is a chance that will cause a side effect that will create furhter lag
which will quickly cause your game to go in a death spiral of lag
this is especially problematic if you put it into something like a phsics engine
in this case extreme lag (which will never happen, so it doesn't matter) might cause a new pipe to be spawned every other frame
i noticed this i think when i tabbed out which is why i set the winnit settings like this so it didn’t lag when i tabbed out i didnt know the reason for it
oh
i also forgot to make a check for if the player goes off screen
don’t get points tho soooo
well then it doesn't matter you can
now that i think about that i have a use case for that lol
sure it only remove a a .0 from something.0 but still
well only for Deref anways
that value should not be changed