Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused)]
- use bevy::{prelude::*, sprite};
- const MAINDUDE: &str = "Playersprite.png";
- const PLAYER_SIZE: (f32, f32) = (144., 74.);
- fn main() {
- App::new()
- .insert_resource(ClearColor(Color::rgb(0.04,0.04,0.04)))
- .insert_resource(WindowDescriptor {
- title: "hehe".to_string(),
- width: 598.0,
- height: 676.0,
- ..Default::default()
- })
- .add_plugins(DefaultPlugins)
- .add_startup_system(setup_system)
- .run();
- }
- fn setup_system(
- mut commands: Commands,
- asset_server: Res<AssetServer>,
- mut texture_atlases: ResMut<Assets<TextureAtlas>>,
- mut windows: ResMut<Windows>,
- ) {
- commands.spawn_bundle(OrthographicCameraBundle::new_2d());
- let window = windows.get_primary_mut().unwrap();
- let (win_w, win_y) = (window.width(),window.height());
- window.set_position(IVec2::new(2780, 4900));
- let bottom = -win_y / 2.;
- commands.spawn_bundle(SpriteBundle{
- texture: asset_server.load(MAINDUDE),
- transform: Transform{
- translation: Vec3::new(0., bottom + PLAYER_SIZE.1 / 2. +5., 10.),
- ..Default::default()
- },
- ..Default::default()
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement