Mercurial > touhou
comparison src/th06/enemy.rs @ 665:965ecdbf0316
Make rank user-defined in eclrenderer.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 11 Aug 2019 20:14:20 +0200 |
parents | f08e8e3c6196 |
children | 838d9402b12f |
comparison
equal
deleted
inserted
replaced
664:f08e8e3c6196 | 665:965ecdbf0316 |
---|---|
301 let mut buf = vec![]; | 301 let mut buf = vec![]; |
302 file.read_to_end(&mut buf).unwrap(); | 302 file.read_to_end(&mut buf).unwrap(); |
303 let anm0 = Anm0::from_slice(&buf).unwrap(); | 303 let anm0 = Anm0::from_slice(&buf).unwrap(); |
304 let anm0 = Rc::new(RefCell::new(anm0)); | 304 let anm0 = Rc::new(RefCell::new(anm0)); |
305 let prng = Rc::new(RefCell::new(Prng::new(0))); | 305 let prng = Rc::new(RefCell::new(Prng::new(0))); |
306 let game = Game::new(prng); | 306 let game = Game::new(prng, Rank::Easy); |
307 let game = Rc::new(RefCell::new(game)); | 307 let game = Rc::new(RefCell::new(game)); |
308 let mut enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game)); | 308 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game)); |
309 let mut enemy = enemy.borrow_mut(); | |
309 assert!(enemy.anmrunner.upgrade().is_none()); | 310 assert!(enemy.anmrunner.upgrade().is_none()); |
310 enemy.set_anim(0); | 311 enemy.set_anim(0); |
311 assert!(enemy.anmrunner.upgrade().is_some()); | 312 assert!(enemy.anmrunner.upgrade().is_some()); |
312 } | 313 } |
313 } | 314 } |