bi_tux

joined 1 year ago
[–] [email protected] 4 points 2 weeks ago

an indian guy on a motor cycle being crushed by a truck

[–] [email protected] 0 points 1 month ago* (last edited 1 month ago)

it's ok, you had no way of knowing it and I imagine most people here fortunately don't know the terms meaning on 4chan

[–] [email protected] 5 points 1 month ago

something like tricorders, they'd be kinda usefull for medical personel or engineers, of course they wouldn't be as advanced as in tng, but still

also I'll get one as soon as they're invented

[–] [email protected] 2 points 1 month ago

anarcho-syndicalism theory and practice by rudolf rocker, it was let's say enligthening, I was already an anarchist before reading it, but now I'm an anarcho-syndicalist

currently reading networking in the rust programming language btw

[–] [email protected] 0 points 1 month ago (3 children)

seeing this 7d later the "hon" at the end just killed me (hon is actually a term used to describe unpassing transwomen who are percieved as ugly, mostly used on 4chans /lgbt board)

[–] [email protected] 0 points 1 month ago

you should be fine, just keep in mind, that estrogen will work better when being in a calorie surplus instead of a deficit (it affects breast growth, female fat distribution and anything fat related)

[–] [email protected] 9 points 1 month ago (2 children)

it's ironic coming from you, I literally recognize you

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago)

giwtwm, I hate how I'm a hon

[–] [email protected] 8 points 1 month ago

I don't like to say this, but:

AI

[–] [email protected] 0 points 1 month ago

that or they're neets

[–] [email protected] 0 points 1 month ago* (last edited 1 month ago)

> be tankie

> have wet dream

> counter strike voice

> terrorists win

[–] [email protected] 0 points 1 month ago (2 children)

members of the venguard party don't usually end up in work camps tho, also those work camps are just educational instututions to denazify the population!!!11!11!

 

I don't really get why my whole acc was banned for 3 comments (some other comments where banned too, but out of pribcipal I think) they just sayed my acc was apologizing genocide or something (even tho I never mentioned Israel)

65
shitpost (lemmy.world)
292
submitted 1 month ago* (last edited 1 month ago) by [email protected] to c/[email protected]
 

This happend to me right noww as I tried to write a gui task manager for the GNU/Linux OS

 

ofc I imediatly upgraded it from winxp to gnu/linux

 

I hope memes are okay here

 

also ik, I still use neofetch instead of hyfetch

 

So I thought about this in the shower amd it makes sense to me, like praying and stuff never worked for most people I know, so a direkt link to god gotta be unlikely. That made me conclude that religion is probably fake, no matter if there's a god or not. Also people speaking to the same god being given a different set of rules sounds stupid, so at least most religions must be fake.

 

Why do some cars have their engines in the front and some in the back, what are the advantages and disadvantages of the two builds. And why doesn't every car have full wheel drive?

218
doggo (lemmy.world)
 
 
1
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/[email protected]
 

So I want to update the sprite so my character looks in a different direction each time the player presses left/right, how could I do this? I can't do it in the setup fn, since it's a startup system, appreciate any help

EDIT: changed formating

here is my code:

use bevy::prelude::*;

`fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest())) // prevents blurry sprites
        .add_systems(Startup, setup)
        .add_systems(Update, animate_sprite)
        .add_systems(Update, player_movement_system)
        .run();
}

const BOUNDS: Vec2 = Vec2::new(1200.0, 640.0);
static mut FLIP_BOOLEAN: bool = false;

fn set_flip_boolean(boolean: bool) {
    unsafe {
        FLIP_BOOLEAN = boolean;
    }
}

fn get_flip_boolean() -> bool{
    unsafe {
        FLIP_BOOLEAN
    }
}

#[derive(Component)]
struct Player {
    movement_speed: f32,
}

#[derive(Component)]
struct AnimationIndices {
    first: usize,
    last: usize,
}

#[derive(Component, Deref, DerefMut)]
struct AnimationTimer(Timer);

fn animate_sprite(
    time: Res<Time>,
    mut query: Query<(&AnimationIndices, &mut AnimationTimer, &mut TextureAtlas)>,
) {
    for (indices, mut timer, mut atlas) in &mut query {
        timer.tick(time.delta());
        if timer.just_finished() {
            atlas.index = if atlas.index == indices.last {
                indices.first
            } else {
                atlas.index + 1
            };
        }
    }
}


fn setup(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
    mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
) {
    let texture = asset_server.load("sprites/Idle01.png");
    let layout = TextureAtlasLayout::from_grid(Vec2::new(64.0, 40.0), 5, 1, None, None);
    let texture_atlas_layout = texture_atlas_layouts.add(layout);
    let animation_indices = AnimationIndices { first: 0, last: 4 };
    let boolean = get_flip_boolean();
    commands.spawn(Camera2dBundle::default());
    commands.spawn((
        SpriteSheetBundle {
            texture,
            atlas: TextureAtlas {
                layout: texture_atlas_layout,
                index: animation_indices.first,
            },
            
            ..default()
        },
        Player {
            movement_speed: 500.0,
        },
        animation_indices,
        AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
    ));
}

fn player_movement_system(
    time: Res<Time>,
    keyboard_input: Res<ButtonInput<KeyCode>>,
    mut query: Query<(&Player, &mut Transform)>,
) {
    let (guy, mut transform) = query.single_mut();

    let mut movement_factor = 0.0;

    let mut movement_direction = Vec3::X;

    if keyboard_input.pressed(KeyCode::ArrowLeft) {
        movement_factor -= 1.0;
        movement_direction = Vec3::X;
        set_flip_boolean(true);
    }

    if keyboard_input.pressed(KeyCode::ArrowRight) {
        movement_factor += 1.0;
        movement_direction = Vec3::X;
        set_flip_boolean(false);
    }

    if keyboard_input.pressed(KeyCode::ArrowUp) {
        movement_factor += 1.0;
        movement_direction = Vec3::Y;
    }

    if keyboard_input.pressed(KeyCode::ArrowDown) {
        movement_factor -= 1.0;
        movement_direction = Vec3::Y;
    }


    let movement_distance = movement_factor * guy.movement_speed * time.delta_seconds();
    let translation_delta = movement_direction * movement_distance;
    transform.translation += translation_delta;

    let extents = Vec3::from((BOUNDS / 2.0, 0.0));
    transform.translation = transform.translation.min(extents).max(-extents);
}
view more: next ›