comparison src/th06/enemy.rs @ 703:81232dac8136

ecl: simplify parsing with more combinators.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 23 Aug 2019 17:37:22 +0200
parents b6c351ca0a35
children 6d4802abe134
comparison
equal deleted inserted replaced
702:718348c7608e 703:81232dac8136
503 file.read_to_end(&mut buf).unwrap(); 503 file.read_to_end(&mut buf).unwrap();
504 let (_, mut anms) = Anm0::from_slice(&buf).unwrap(); 504 let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
505 let anm0 = anms.pop().unwrap(); 505 let anm0 = anms.pop().unwrap();
506 let anm0 = Rc::new(RefCell::new(anm0)); 506 let anm0 = Rc::new(RefCell::new(anm0));
507 let prng = Rc::new(RefCell::new(Prng::new(0))); 507 let prng = Rc::new(RefCell::new(Prng::new(0)));
508 let game = Game::new(prng, Rank::Easy); 508 let game = Game::new(prng, Rank::EASY);
509 let game = Rc::new(RefCell::new(game)); 509 let game = Rc::new(RefCell::new(game));
510 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game)); 510 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game));
511 let mut enemy = enemy.borrow_mut(); 511 let mut enemy = enemy.borrow_mut();
512 assert!(enemy.anmrunner.upgrade().is_none()); 512 assert!(enemy.anmrunner.upgrade().is_none());
513 enemy.set_anim(0); 513 enemy.set_anim(0);