Commits

jagt  committed 30e54b6

under panel done, and populated fan

  • Participants
  • Parent commits 1199be1

Comments (0)

Files changed (10)

+syntax: glob
+
+*.swp

File GameWorld.as

 		private var _bgplain:BgPlain;
 		private var _bgstripe:Entity;
 		private var _panel:Panel;
+		private var _under:UnderPanel;
 		private var _text:Entity;
 		private var _playsfx:Sfx;
 		private var _spawnsfx:Sfx;
 		
 		private var _tline:Line; // temp pointer
 		private var _textcnter:int; // flick timer
+		private var _levelcnt:int;
 		
 		override public function begin():void
 		{
 			_bgplain = new BgPlain();
 			_bgstripe = new Entity(0, 0, new Backdrop(Au.ImgBg));
 			_panel = new Panel();
+			_under = new UnderPanel();
 			_text = new Entity(12, 40, new Text("press SHIFT key\n    to return"));
 			Text(_text.graphic).size = 8;
 			_text.visible = false;
 			
 			add(_text);
 			add(_panel);
+			add(_under);
 			
 			// init
 			_levelix = 0;
+			_levelcnt = 1;
 			switchLevel(new (Au.levelArr[_levelix]));
 			switchPhase(INDI_PHASE);
 			_bgmsfx.play();
+			_under.show(_levelcnt++);
 			
 			// debugs
-//			switchLevel(new RMFan);
+			switchLevel(new Hole);
 //			FP.console.enable();
 		}
 	
 					Hurter.killAll();
 					_bgplain.holdStarts();
 					switchPhase(HOLD_PHASE);
+					_under.show(_levelcnt++);
 				} else if (_oix < _levellength) {
 					// still handle one at a frame
 					// shouldn't differ a lot
 				}
 			} else if (_phase == HOLD_PHASE) {
 				if (_framecnt == Au.HOLD_TIME) {
+					
 					if (player.active == false) {
 						_spawnsfx.play();
 						player.reset(47, 47);
 			}
 			
 			// debugs
+			FP.world.active = true;
+			if (Input.check(Key.SPACE)) {
+				FP.world.active = false;
+			}
+
 //			if (Input.pressed(Key.R)) {
 //				FP.world = new GameWorld();
 //			}
 		public static const ImgPanel:Class;
 		
 		private var showarr:Array = [
-			-12, -10, -8, -6, -4, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,
+			-12, -10, -8, -6, -4, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 			 -2,  -4, -8, -10, -12,
 		];
 		

File UnderPanel.as

+package
+{
+	import net.flashpunk.Entity;
+	import net.flashpunk.FP;
+	import net.flashpunk.Graphic;
+	import net.flashpunk.Mask;
+	import net.flashpunk.graphics.Image;
+	import net.flashpunk.graphics.Text;
+	
+	public class UnderPanel extends Entity
+	{
+		[Embed(source = 'data/under.png')]
+		private const ImgUnder:Class;
+		
+		private var showarr:Array = [
+			0, -2, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			2, 2, 2, 2, 2, 2,
+		];
+		
+		public var spr:Image;
+		private var _text:Text;
+		private var _texten:Entity;
+		private var _showix:int = 0;
+		private var _show:Boolean = false;
+		
+		public function UnderPanel()
+		{
+			spr = new Image(ImgUnder);
+			super(0, 96, spr);
+			// init text
+			_text = new Text("1  ");
+			_text.size = 12;
+			_text.color = Au.HEADCOLOR;
+			_text.smooth = false;
+			_texten = new Entity(1, 100, _text);
+		}
+		
+		public function show(Level:int):void
+		{
+			_show = true;
+			_showix = 0;
+			_text.text = Level.toString();
+		}
+		
+		override public function added():void
+		{
+			FP.world.add(_texten); // auto add
+		}
+		
+		override public function update():void
+		{
+			if (_show) {
+				y += showarr[_showix++];
+				if (_showix == showarr.length) _show = false;
+				_texten.y = y + 0;
+			}
+			super.update();
+		}
+		
+	}
+}

File data/under.png

Added
New image

File hurts/HLine.as

 		[Embed(source = 'data/line.png')]
 		private static const ImgLine:Class;
 		
+		private static const HEADCOLOR:uint = 0xFF3366;
+		
 //		private static const _imline:PreRotation;
 //		_imline = new PreRotation(ImgLine, 80);
 		// TODO maybe should use Image not PreRotation
 		
 		/////////////////////////////////////
-		private var _imline:Image;
+		private var _line:Line; // the handled line
+//		private var _imline:Image;
 		private var _vec:Vector2D;
 		private var _emitx:Number;
 		private var _emity:Number;
 		
 		public function  HLine()
 		{
-			_imline = new Image(ImgLine);
+//			_imline = new Image(ImgLine);
 			_vec = new Vector2D(0, 0);
-			super(0, 0, _imline);	
+			super(0, 0);	
 			active = false;
 			visible = false;
 			type = "hurtline";
 		}
 		
 		public function reset(Lin:Line):void {
+			_line = Lin;
 			_emitx = x = Lin.startx; _emity = y = Lin.starty;
 			_vec.set(Lin.endx - Lin.startx, Lin.endy - Lin.starty);
 			_vec.magnitude = 2; // TODO remove this
-			_imline.angle = -_vec.angle; // MUST get reverse cause
+//			_imline.angle = -_vec.angle; // MUST get reverse cause
 			// game coordinates are reverse
 			// use rotated image to get a pixelperfect mask
 			mask = new Linemask(0, 0, _vec); 
 			super.update();
 		}
 		
+		override public function render():void 
+		{
+			super.render();	
+			if (visible) {
+				Draw.line(_line.startx, _line.starty,
+					_line.endx, _line.endy, HEADCOLOR); 
+			}
+		}
+		
 //		override public function render():void {
 //			var lm:Linemask = mask as Linemask;
 //			Draw.line(0, _player.y-_player.originY, 100, _player.y-_player.originY, 0x0000FF);

File levels/Hole.as

 
 	public class Hole extends LevelBase
 	{
+		public function Hole()
+		{
+			waves = 3;
+		}
 		override public function leveldata(wave:int):Vector.<Obj> 
 		{
 			// BUG: if Obj start at 0th frame things gonna fail
 			// always start at 1 frame
-			var data:Array = [
+			var data:Array;
+			if (wave == 0) {
+			data = [
 				// whole 1
 				new Line(  1,  30,  0,  0, 26),  
 				new Line(  4,  18,  0,  0, 45),  
 				new Line( 92,   8, 95, 95, 24),
 				new Line( 96,  24, 95, 63,  0),
 			];
+			} else if (wave == 1) {
+			data = [
+				// hole 1
+				new Line(  1,  85,  0,  0, 46),  
+				new Line(  4,  56,  0,  0, 95),  
+				new Line(  8,   6,  0, 87, 95), // 
+				new Line( 12,   0, 26, 95, 64),  
+				new Line( 16,   0, 59, 95, 35),  
+				new Line( 20,   0, 92, 95, 13), //  
+				new Line( 24,  42, 95, 76,  0),  
+				new Line( 28,  95, 88, 48,  0),  
+				new Line( 32,  95, 32,  0,  6), // 
+				// whole 2
+				new Line( 70,  72,  0,  0, 70),
+				new Line( 74,  56,  0, 22, 96),
+				new Line( 78,  33,  0, 69, 96),
+				new Line( 82,   0, 14, 95, 70),
+				new Line( 86,   0, 57, 96, 39),
+				new Line( 90,  11, 95, 95, 18),
+				new Line( 94,  25, 95, 91,  0),
+				new Line( 98,  78, 95, 70,  0),
+				new Line(102,  95, 55, 52,  0),
+				new Line(106,  95, 27,  0,  0),
+			];
+			} else {
+			data = [
+				// hole 1
+				new Line(  1,  73,  0,  0, 67),  
+				new Line(  4,  40,  0, 19, 95),  
+				new Line(  8,  19,  0, 42, 95), // 
+				new Line( 12,   0, 14, 67, 95),  
+				new Line( 16,   0, 81, 95, 46),  
+				new Line( 20,  29, 95, 95, 14), //  
+				new Line( 24,  57, 95, 68,  0),  
+				new Line( 28,  95, 80, 33,  0),  
+				new Line( 32,  95, 40,  1, 18), // 
+				// whole 2
+				new Line( 70,  56,  0, 10, 95),
+				new Line( 74,   0, 78, 95, 19),
+				new Line( 78,  25,  0, 60, 95),
+				new Line( 82,   0, 61, 95, 33),
+				new Line( 86,  72, 95, 45,  0),
+				new Line( 90,   0,  6, 95, 93),
+				new Line( 94,  95, 52,  0,  5),
+				new Line( 98,  27, 95, 76,  0),
+				new Line(102,  95, 66, 19,  0),
+				new Line(106,  95, 25,  0, 36),
+			];
+				
+			}
 			
 			return Vector.<Obj>(data);
 		}

File levels/Level0.as

 		{
 			var data:Array = [
 				// rect 1
-				new Line(10,  0,  2,  93,  2),
-				new Line(11, 93,  2,  93, 93),
-				new Line(12, 93, 93,   2, 93),
-				new Line(13,  2, 93,   2,  2),
+				new Line(10,  0,  2,  95,  2),
+				new Line(11, 93,  0,  93, 95),
+				new Line(12, 95, 93,   0, 93),
+				new Line(13,  2, 95,   2,  0),
 				// rect 2
-				new Line(30,  0,  4,  91,  4),
-				new Line(31, 91,  4,  91, 91),
-				new Line(32, 91, 91,   4, 91),
-				new Line(33,  4, 91,   4,  4),
+				new Line(30,  0,  4,  95,  4),
+				new Line(31, 91,  0,  91, 95),
+				new Line(32, 95, 91,   0, 91),
+				new Line(33,  4, 95,   4,  0),
 				// rect 3
-				new Line(60,  0,  8,  87,  8),
-				new Line(61, 87,  8,  87, 87),
-				new Line(62, 87, 87,   8, 87),
-				new Line(63,  8, 87,   8,  8),
+				new Line(60,  0,  8,  95,  8),
+				new Line(61, 87,  0,  87, 95),
+				new Line(62, 95, 87,   0, 87),
+				new Line(63,  8, 95,   8,  0),
 				// rect 4
-				new Line(90,  0, 14,  81, 14),
-				new Line(91, 81, 14,  81, 81),
-				new Line(92, 81, 81,  14, 81),
-				new Line(93, 14, 81,  14, 14),
+				new Line(90,  0, 14,  95, 14),
+				new Line(91, 81,  0,  81, 95),
+				new Line(92, 95, 81,   0, 81),
+				new Line(93, 14, 95,  14,  0),
 				// rect 5
-				new Line(116,  0, 20,  75, 20),
-				new Line(117, 75, 20,  75, 75),
-				new Line(118, 75, 75,  20, 75),
-				new Line(119, 20, 75,  20, 20),
+				new Line(116,  0, 20,  95, 20),
+				new Line(117, 75,  0,  75, 95),
+				new Line(118, 95, 75,   0, 75),
+				new Line(119, 20, 95,  20,  0),
 			];
 			
 			return Vector.<Obj>(data);

File net/flashpunk/utils/Draw.as

 				xx:int,
 				yy:int;
 			
+//			screen.lock();
 			// draw a single pixel
 			if (X == 0)
 			{
 				if (Y == 0)
 				{
 					screen.setPixel32(x1, y1, color);
+//					screen.unlock();
 					return;
 				}
 				// draw a straight vertical line
 					y1 += yy;
 				}
 				screen.setPixel32(x2, y2, color);
+//				screen.unlock();
 				return;
 			}
 			
 					x1 += xx;
 				}
 				screen.setPixel32(x2, y2, color);
+//				screen.unlock();
 				return;
 			}
 			
 				}
 				screen.setPixel32(x2, y2, color);
 			}
+//			screen.unlock();
 		}
 		
 		/**

File objs/Line.as

 		public var starty:Number;
 		public var endx:Number;
 		public var endy:Number;
-		public var linetype:int;
 		
 		public function Line(Frame:int, Startx:Number, Starty:Number,
 							Endx:Number, Endy:Number, Dx:Number=0, Dy:Number=0, Both:Boolean=false)