You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut player = Entity::new("main");// Defines a playerletmut scn = Scene::new("main");// Defines a scene
scn.load_texture("player","assets/Warrior_Yellow.png");// Loads texture with id of "player" from filepath "assets/Warrior_Yellow.png" to scenelet p_ridle = Animation::new_loop("player",100.0,(192,192),Some((0,5)));// Creates a looped animation, each frame is 192x192px and loops between 0, to 5 (rectangles indx. in texture) each frame stays 100mslet def = PhysicalProperties::default();// Create default physics
player.set_physics(PhysicalProperties{// Set physical properties of player to simulatecollision_enabled:true,show_collider:true,show_solid_box:true,solid_box_margin:(60.0,60.0),collision_type:CollisionType::Vectoral,speed:0.3,mass:1.0,
..def.clone()// fill other properties same as default});
player.add_animation("p_ridle", p_ridle);// Add animation to player
scn.add_entity(player);// Add player to screenletmut game = Game::new("Game",Style::CLOSE, scn);// Create game with active scene.
game.run((900,600));// Run game with window size/*Thre are also some events like:scn.on_keystate_changed,scn.on_update,scn.on_collision,scn.on_start,And physics is simulated using Axis Aligned Box collisions.*/