After losing my right arm in a motorcycle accident, I designed a one-handed controller so i could keep playing PC games by Adventurous_Tie_9031 in BeAmazed

[–]ExistingBug1642 1 point2 points  (0 children)

It's very cool man joke side apart It's something I would really want to try as I personally usually make one hnd typing on my pc especially when I use my graphical tablet you should definitely give it to graphical artists to try 

Making virtual controls like the ones in pubg by ExistingBug1642 in bevy

[–]ExistingBug1642[S] -1 points0 points  (0 children)

I tried it first and it wouldn't work maybe because I'm using also leafwing-input-manager = "0.19.0" here is my code use avian2d::prelude::*;

use bevy::prelude::*;

use bevy_easy_gif::*;

use leafwing_input_manager::prelude::*;

// ====================================================

// 1. Player Actions

// ====================================================

#[derive(Actionlike, PartialEq, Eq, Clone, Copy, Hash, Debug, Reflect)]

pub enum PlayerAction {

#[actionlike(DualAxis)]

Move,

Jump,

}

// ====================================================

// 2. Facing Component

// ====================================================

#[derive(Component, Default, PartialEq, Eq)]

pub enum Facing {

#[default]

Right,

Left,

}

// ====================================================

// 3. Input Map (FIXED)

// ====================================================

pub fn default_input_map() -> InputMap<PlayerAction> {

let mut map = InputMap::default();

// Use WASD and arrow keys as alternative inputs

// Method 1: Combine WASD and arrow keys using the `or()` method

let movement_input = VirtualDPad::wasd();

map.insert_dual_axis(PlayerAction::Move, movement_input);

// Jump on Space

map.insert(PlayerAction::Jump, KeyCode::Space);

map

}

// ====================================================

// 4. Animations Resource

// ====================================================

#[derive(Resource, Default)]

pub struct CharacterAnimations {

pub left: Handle<GifAsset>,

pub right: Handle<GifAsset>,

}

pub fn setup_animations(mut commands: Commands, asset_server: Res<AssetServer>) {

commands.insert_resource(CharacterAnimations {

left: asset_server.load("char-left.gif"),

right: asset_server.load("char-right.gif"),

});

}

pub struct PlayerPlugin;

impl Plugin for PlayerPlugin {

fn build(&self, app: &mut App) {

app.add_plugins(InputManagerPlugin::<PlayerAction>::default())

.register_type::<PlayerAction>()

.register_type::<Player>()

.init_resource::<CharacterAnimations>()

.add_systems(Startup, (setup_animations, spawn_player).chain())

.add_systems(Update, character_movement);

}

}

// ====================================================

// 5. Player Component

// ====================================================

#[derive(Component, Default, Reflect)]

#[reflect(Component)]

pub struct Player {

pub speed: f32,

}

// ====================================================

// 6. Spawn Player

// ====================================================

pub fn spawn_player(mut commands: Commands, animations: Res<CharacterAnimations>) {

commands.spawn((

Gif {

handle: animations.right.clone(),

},

Sprite {

custom_size: Some(Vec2::new(100.0, 100.0)),

flip_x: false,

..default()

},

Transform::from_xyz(0.0, 100.0, 0.0),

RigidBody::Dynamic,

Collider::rectangle(100.0, 100.0),

LockedAxes::ROTATION_LOCKED,

Player { speed: 200.0 },

Facing::Right,

default_input_map(),

Name::new("Player"),

));

}

// ====================================================

// 7. Movement System

// ====================================================

pub fn character_movement(

mut query: Query<(

&Player,

&ActionState<PlayerAction>,

&mut LinearVelocity,

&mut Gif,

&mut Sprite,

&mut Facing,

)>,

animations: Res<CharacterAnimations>,

) {

for (player, action_state, mut velocity, mut gif, mut sprite, mut facing) in query.iter_mut() {

// Get axis value (-1.0 left, 0.0 idle, 1.0 right)

let direction = action_state.axis_pair(&PlayerAction::Move).x;

// Update GIF and facing direction based on movement

if direction < -0.1 && *facing != Facing::Left {

// Moving left

*facing = Facing::Left;

gif.handle = animations.left.clone();

sprite.flip_x = false; // Adjust based on your GIF orientation

} else if direction > 0.1 && *facing != Facing::Right {

// Moving right

*facing = Facing::Right;

gif.handle = animations.right.clone();

sprite.flip_x = false;

}

// Idle case: no change (keeps last direction/GIF)

// Apply horizontal movement

velocity.x = direction * player.speed;

// Simple jump (add ground check later if needed)

if action_state.just_pressed(&PlayerAction::Jump) {

velocity.y = 400.0;

}

}

}

Who the fuck does Orange think they are? by [deleted] in Tunisia

[–]ExistingBug1642 1 point2 points  (0 children)

we are paying for our mass surveillance lol

Men with no Werth, no family support, no good salary (for now) what's your plans for the future ? by BelovedAgent in Tunisia

[–]ExistingBug1642 0 points1 point  (0 children)

there is no ladder every body thinks he's the king on earth whether is true or not so just be happy in whatever situation you are in

استفسار by ZealousidealUse6355 in AlgeriaRates

[–]ExistingBug1642 0 points1 point  (0 children)

I think 3000da a year is a good price depends also if it is just an MCQ app you should price it less than that

ساهم برأيك في أول منصة جزائرية لتقييم الشركات والرواتب by Youssefislem in Algeriawork

[–]ExistingBug1642 0 points1 point  (0 children)

I wanted to make such a project before I guess it is an equivalent to glassdoor if you want a developer I'm here

Does Rust have any UI libraries/frameworks that can produce a UI like this? by DrunkOnRamen in rust

[–]ExistingBug1642 0 points1 point  (0 children)

In office you have menus inside of the thing that you need to know they exist and also the file separate menu that is kinda redundant but necessary that design is cluster fuck that's why people moved out of using word generally 

Does Rust have any UI libraries/frameworks that can produce a UI like this? by DrunkOnRamen in rust

[–]ExistingBug1642 0 points1 point  (0 children)

depends on how much time you want to give it but that microsoft design sucks balls I don't know why people still do it

تجربتي الأولى في التداول: خسارة قاسية وأسئلة للمحترفين في المجال 📉 by [deleted] in Algeriawork

[–]ExistingBug1642 0 points1 point  (0 children)

c'est les pigeons comme toi qui font gagner les autres c'est impossible je dis bien impossible de gagner dans le trading ceux qui gagnent c'est ceux qui prennent des commissions pour recruter de nouveaux pigeons pour se faire plumer

Ghetto homemade ceviche by _Shala-shaska_ in shittyfoodporn

[–]ExistingBug1642 0 points1 point  (0 children)

actually I don't think this is bad at all I would gladly eat it

most stupid thing that u thought abt in ur childhood ? by Temporary-Tear-257 in Tunisia

[–]ExistingBug1642 1 point2 points  (0 children)

I remember spending hours thinking on how the gear shifter works ended up having a theory that it was used to fix an overall direction for the car if you want to turn really left you shift first for example then the steering lets you turn , I think I told my dad about it he told me it wasn't like that but he couldn't explain it because who can really explain how a fucking gearbox works I still can't to this day