Rename module

This commit is contained in:
Thomas Gideon 2017-07-13 12:49:08 -04:00
parent 010028fef9
commit ce783a3609
2 changed files with 8 additions and 8 deletions

View file

@ -6,13 +6,13 @@ extern crate piston_window;
extern crate sprite;
extern crate uuid;
mod object;
mod mobs;
use gfx_device_gl::Resources;
use graphics::Image;
use graphics::rectangle::square;
use piston_window::*;
use object::Object;
use mobs::Hero;
use sprite::*;
// TODO move this into the player object
@ -20,7 +20,7 @@ const MV_FACT: f64 = 2500.0;
pub struct Game {
scene: Scene<Texture<Resources>>,
player: Object,
player: Hero,
up_d: bool,
down_d: bool,
left_d: bool,
@ -30,7 +30,7 @@ pub struct Game {
impl Game {
pub fn new(w: &mut PistonWindow) -> Game {
let mut scene = Scene::new();
let player = Object::new(w, &mut scene);
let player = Hero::new(w, &mut scene);
Game {
scene: scene,
player: player,

View file

@ -8,14 +8,14 @@ use std::rc::Rc;
// TODO add size of player sprite for boundary checking
pub struct Object {
pub struct Hero {
pub sprite_id: Uuid,
pub x: f64,
pub y: f64,
}
impl Object {
pub fn new(w: &mut PistonWindow, scene: &mut Scene<Texture<Resources>>) -> Object {
impl Hero {
pub fn new(w: &mut PistonWindow, scene: &mut Scene<Texture<Resources>>) -> Hero {
let assets = find_folder::Search::ParentsThenKids(3, 3)
.for_folder("assets")
.unwrap();
@ -27,7 +27,7 @@ impl Object {
let mut sprite = Sprite::from_texture(tex);
sprite.set_position(320.0, 240.0);
let sprite_id = scene.add_child(sprite);
Object {
Hero {
x: 320.0,
y: 240.0,
sprite_id: sprite_id,