This repository has been archived on 2022-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
elmariomomento/src/main.rs
2022-05-20 19:29:16 -05:00

28 lines
776 B
Rust

use cat_box::{draw_text, Game, Sprite, SpriteCollection};
use std::{thread, time};
fn main() {
let game = Game::new("Running", 500, 500);
//main sprite introductions
let mut i = 255u8;
let mut running = SpriteCollection::new();
let mut run1 = Sprite::new("runner_0.png", 250, 250).unwrap();
let mut run2 = Sprite::new("runner_1.png", 250, 250).unwrap();
let mut stand = Sprite::new("runner_s.png", 250, 250).unwrap();
running.push(run1);
//sleeper agent
let sleep = thread::sleep;
//main game loop
game.run(|ctx|{
if i<200{
i = i + 10;
}else if i >= 255{
i=200;
}
ctx.set_background_colour( 129, 201, i);
running.draw(ctx).unwrap();
}).unwrap();
}