more mario like controls

This commit is contained in:
2015-01-12 20:31:04 +01:00
parent 817e66ec67
commit 9465b750b6
2 changed files with 35 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
use std::iter::repeat;
use std::cmp::{min, max};
use sdl2::rect::{Point, Rect};
use sdl2::rect::Rect;
pub struct Layer<T> {
@@ -26,7 +26,7 @@ impl<T> Layer<T> where T: Clone {
pub fn get_tile(&self, x: i32, y: i32) -> Option<&T> {
let offset = (x + y * self.width) as usize;
if offset >= 0 && offset < self.tiles.len() {
if offset < self.tiles.len() {
Some(&self.tiles[offset])
} else {
None