Changeset 5515 for lang/actionscript/misc
- Timestamp:
- 01/25/08 23:00:37 (5 years ago)
- Location:
- lang/actionscript/misc/mario
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/misc/mario/Actor.as
r5472 r5515 1 1 package { 2 2 //============================================================================= 3 import The; 4 3 5 public class Actor { 4 6 public var x: int; … … 6 8 public var vx: int; 7 9 public var vy: int; 10 11 public var chr: int; ///< キャラ 8 12 9 13 public var hitofsx: int; ///< 当たり判定開始左上座標 … … 19 23 } 20 24 25 // 更新処理 21 26 public function update(): Boolean { return false; } 22 public function render(g: JGraphics): void { } 27 28 // 描画 29 public function render(g: JGraphics): void { 30 g.drawImage(The.resmgr.img[chr], x/The.ONE, y/The.ONE); 31 } 23 32 } 24 33 //============================================================================= -
lang/actionscript/misc/mario/Bar.as
r5472 r5515 8 8 9 9 public class Bar extends Actor { 10 private var chr: int;11 12 10 public function Bar(_x: int, _y: int) { 13 11 x = _x * The.ONE; … … 28 26 return true; 29 27 } 30 31 // 描画32 override public function render(g: JGraphics): void {33 g.drawImage(The.resmgr.img[chr], x/The.ONE, y/The.ONE);34 }35 28 } 36 29 //============================================================================= -
lang/actionscript/misc/mario/KeyState.as
r5237 r5515 47 47 code = D; 48 48 break; 49 case 0x5a: // 'Z'49 case 0x5a: case 32: // 'Z', ' ' 50 50 code = A; 51 51 break; -
lang/actionscript/misc/mario/Makefile
r5237 r5515 2 2 PROJECT=Mario 3 3 4 all: 4 SRCS = $(wildcard *.as) 5 6 all: $(PROJECT).swf 7 8 $(PROJECT).swf: $(SRCS) 5 9 mxmlc -incremental=true -default-size 256 240 -default-frame-rate=60 -default-background-color=0x000000 $(PROJECT).as 6 10 -
lang/actionscript/misc/mario/Map.as
r5472 r5515 1 1 package { 2 2 //============================================================================= 3 import The; 4 3 5 public class Map { 6 private static const MX: int = The.SCREEN_WIDTH / The.BLOCKW; 7 private static const MY: int = The.SCREEN_HEIGHT / The.BLOCKH; 8 4 9 public var map: Array = [ 5 10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … … 14 19 0, 0, 0, 0, 0, 0, 2, 4, 2, 4, 2, 0, 0, 0, 0, 0, 15 20 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,17 0, 7, 8,10, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3,18 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,19 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,21 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22 0, 7, 8,10, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 24 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 20 25 ]; 21 26 22 27 /// マップのキャラ取得 23 28 public function get_chr(x: int , y: int): int { 24 return map[x + y * 16]; 29 if (x < 0) x = 0; 30 if (x >= MX) x = MX - 1; 31 return map[x + y * MX]; 25 32 } 26 33 27 34 /// マップにキャラセット 28 35 public function set_chr(x: int , y: int, c: int): void { 29 map[x + y * 16] = c;36 map[x + y * MX] = c; 30 37 } 31 38 … … 33 40 public function render(g: JGraphics): void { 34 41 var resmgr: ResourceManager = The.resmgr; 35 for (var i: Number = 0; i < 16; ++i) {36 var y: int = i * 16;37 for (var j: Number = 0; j < 16; ++j) {42 for (var i: Number = 0; i < MY; ++i) { 43 var y: int = i * The.BLOCKH; 44 for (var j: Number = 0; j < MX; ++j) { 38 45 var c: int = get_chr(j, i); 39 46 if (c != The.eChrEmpty && c != The.eChrEmptyBlock) { 40 var x: int = j * 16;47 var x: int = j * The.BLOCKW; 41 48 g.drawImage(resmgr.img[c], x, y); 42 49 } -
lang/actionscript/misc/mario/Mario.as
r5472 r5515 85 85 private function render(): void { 86 86 //背景の描画 87 g.setColor(RGB( 0, 0, 0));87 g.setColor(RGB(40,145,255)); 88 88 g.fillRect(0, 0, The.SCREEN_WIDTH, The.SCREEN_HEIGHT); 89 89 -
lang/actionscript/misc/mario/Player.as
r5472 r5515 8 8 9 9 public class Player extends Actor { 10 private var chr: int; ///< キャラ11 10 private var dir: int; ///< 向き 12 11 private var step: int; ///< アニメカウンタ … … 96 95 if (vy > 0) { 97 96 if (is_ground(0)) { 98 // y = The.SCREEN_HEIGHT * The.ONE;99 97 vy = 0; 100 98 stand = true; … … 124 122 } 125 123 126 if (x < (The.ChrW/2)*The.ONE) { 127 x = (The.ChrW/2)*The.ONE; 128 if (!stand) { 129 vx = 0; 130 } 131 } 132 if (x > (The.SCREEN_WIDTH-The.ChrW/2)*The.ONE) { 133 x = (The.SCREEN_WIDTH-The.ChrW/2)*The.ONE; 134 if (!stand) { 135 vx = 0; 124 if (false) { 125 if (x < (The.ChrW/2)*The.ONE) { 126 x = (The.ChrW/2)*The.ONE; 127 if (!stand) { 128 vx = 0; 129 } 130 } 131 if (x > (The.SCREEN_WIDTH-The.ChrW/2)*The.ONE) { 132 x = (The.SCREEN_WIDTH-The.ChrW/2)*The.ONE; 133 if (!stand) { 134 vx = 0; 135 } 136 } 137 } else { 138 // 左右ループ 139 if (x < -(The.ChrW/2)*The.ONE) { 140 x = (The.SCREEN_WIDTH+The.ChrW/2-1)*The.ONE; 141 } 142 if (x > (The.SCREEN_WIDTH+The.ChrW/2)*The.ONE) { 143 x = (-The.ChrW/2+1)*The.ONE; 136 144 } 137 145 } -
lang/actionscript/misc/mario/ResourceManager.as
r5472 r5515 9 9 [Embed(source='data/block3.png')] private static const ImgBlock3: Class; 10 10 [Embed(source='data/block4.png')] private static const ImgBlock4: Class; 11 [Embed(source='data/block5. gif')] private static const ImgBlock5: Class;11 [Embed(source='data/block5.png')] private static const ImgBlock5: Class; 12 12 13 13 [Embed(source='data/mountain02.png')] private static const ImgMountain02: Class; … … 35 35 [Embed(source='data/image_14.png')] private static const ImgPanel14: Class; 36 36 37 [Embed(source='data/bar. gif')] private static const ImgBar: Class;37 [Embed(source='data/bar.png')] private static const ImgBar: Class; 38 38 39 39 public var b_complete: String; … … 76 76 ]; 77 77 78 [Embed(source='data/main.mp3')] private static const SoundBgm: Class;78 // [Embed(source='data/main.mp3')] private static const SoundBgm: Class; 79 79 // [Embed(source='data/jump.wav')] private static const SoundJump: Class; 80 80 81 81 private var snd_tbl: Array = [ 82 SoundBgm,82 // SoundBgm, 83 83 ]; 84 84 -
lang/actionscript/misc/mario/UnbrokenBlock.as
r5472 r5515 10 10 11 11 public class UnbrokenBlock extends Actor { 12 private var chr: int;13 12 private var mx: int; 14 13 private var my: int; … … 36 35 return true; 37 36 } 38 39 // 描画40 override public function render(g: JGraphics): void {41 g.drawImage(The.resmgr.img[chr], x/The.ONE, y/The.ONE);42 }43 37 } 44 38 //=============================================================================
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)