Jake Albano avatar Jake Albano committed 11d6d19

Added html page for deployment;
Added "click to start" to solve focus problem when running in browser;
Fixed bug where enemies would never use melee attacks when they were close enough;
Fixed bug where player could be destroyed when loading a level before the HUD was available;

Comments (0)

Files changed (8)

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+	<head>
+		<title>Baseborn -- Thaumaturgist games</title>
+		<link rel="stylesheet" type="text/css" href="style.css" />
+		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+		<script type="text/javascript" src="swfobject.js"></script>
+		<script type="text/javascript">
+			swfobject.registerObject("baseborn_swf", "10.0.0");
+		</script>
+	</head>
+	<body>
+		<div id = "title">
+			<img src= "title.png" />
+		</div>
+		<hr>
+		<div id = "game">
+			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1000" height="500" id="baseborn_swf">
+				<param name="movie" value="FLAKit.swf" />
+				<!--[if !IE]>-->
+				<object type="application/x-shockwave-flash" data="FLAKit.swf" width="1000" height="500">
+				<!--<![endif]-->
+					<a href="http://www.adobe.com/go/getflashplayer">
+						<p>Either you don't have Flash installed or you've disabled Javascript. We need both of those things working for the game to start!</p>
+						<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
+					</a>
+				<!--[if !IE]>-->
+				</object>
+				<!--<![endif]-->
+			</object>
+		</div>
+		<div id = "info">
+			<p>
+				Your progress is automatically saved at the end of each level
+			</p>
+			<p>
+				<strong>
+					Controls:
+				</strong>
+				<ul>
+					<li>
+						Arrow keys to move
+					</li>
+					<li>
+						Spacebar or up-arrow to jump
+					</li>
+					<li>
+						Enter/Return to restart level
+					</li>
+					<li>
+						A, S, and D to attack
+					</li>
+					<li>
+						R to restart the game
+					</li>
+					<li>
+						M to mute audio
+					</li>
+				</ul>
+			</p>
+		</div>
+	</body>
+</html>
+body {
+	background-color: black;
+}
+
+#title {
+	width: 1000px;
+	height: 40px;
+	margin-left: auto;
+	margin-right: auto;
+	background-repeat: no-repeat;
+	position: relative;
+}
+
+#title img
+{
+	margin-top: 0px;
+	margin-bottom: 0px;
+	margin-left: 25px;
+	position: absolute;
+	bottom: 0;
+}
+
+#game {
+	width: 1000px;
+	height: 500px;
+	margin-left: auto;
+	margin-right: auto;
+	margin-top: 10px;
+}
+
+#info {
+	width: 1000px;
+	height: 500px;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+#info p, ul
+{
+	margin-left: 40px;
+	color: white;
+}
Add a comment to this file

lib/titleScreen.png

Old
Old image
New
New image

obj/IfritConfig.xml

     </define>
     <define append="true">
       <name>CONFIG::timeStamp</name>
-      <value>'5/13/2012'</value>
+      <value>'7/30/2012'</value>
     </define>
     <verbose-stacktraces>true</verbose-stacktraces>
     <source-path append="true">
-      <path-element>C:\Users\Jake\Documents\Flashdevelop\Ifrit\src</path-element>
+      <path-element>C:\Users\Jake\Documents\FlashDevelop\Ifrit\src</path-element>
       <path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
     </source-path>
   </compiler>
   <file-specs>
-    <path-element>C:\Users\Jake\Documents\Flashdevelop\Ifrit\src\Game.as</path-element>
+    <path-element>C:\Users\Jake\Documents\FlashDevelop\Ifrit\src\Game.as</path-element>
   </file-specs>
   <default-background-color>#FFFFFF</default-background-color>
   <default-frame-rate>30</default-frame-rate>
 	import com.thaumaturgistgames.flakit.Library;
 	import flash.display.Stage;
 	import flash.events.Event;
+	import flash.events.MouseEvent;
 	import flash.geom.Point;
 	import ifrit.*;
 	
 		public static var man:Player;
 		public static var boss:Boss;
 		public static var playerClass:uint;
+		public var startScreen:IfritObject;
 		
 		public static const DEBUG_MODE:Boolean = true;
 		
 		public function Game()
 		{
-			super(Library.USE_ALL);//, EmbeddedAssets);
+			super(Library.USE_ALL, EmbeddedAssets);
 		}
 		
 		override public function init():void 
 			super.init();
 			
 			Game.stage = this.stage;
-			
 			removeEventListener(Event.ADDED_TO_STAGE, init);
-			addEventListener(Event.ENTER_FRAME, enterFrame);
 			
 			Input.init(stage);
 			
 			
 			World.init();
 			
-			Game.playerClass = SaveState.playerClass;
+			if (!DEBUG_MODE)
+			{
+				this.startScreen = new IfritObject();
+				this.startScreen.addChild(Library.getImage("titleScreen.png"));
+				this.startScreen.x = 450;
+				this.startScreen.y = 225;
+				Game.stage.addEventListener(MouseEvent.CLICK, titleScreenClick);
+				stage.addChild(this.startScreen);
+			}
+			else
+			{
+				Game.stage.addEventListener(Event.ENTER_FRAME, enterFrame);
+				
+				Game.playerClass = SaveState.playerClass;
 			
-			WorldUtils.loadLevel( SaveState.level );
+				WorldUtils.loadLevel( SaveState.level );
+			}
+		}
+		
+		private function titleScreenClick(e:MouseEvent):void
+		{
+			Game.stage.removeEventListener(MouseEvent.CLICK, titleScreenClick);
+			Game.stage.addEventListener(Event.ENTER_FRAME, titleScreenEnterFrame);
+		}
+		
+		private function titleScreenEnterFrame(e:Event):void
+		{
+			if ((this.startScreen.alpha -= 0.1) >= 0)
+			{
+				Game.stage.removeChild(this.startScreen);
+				Game.stage.removeEventListener(Event.ENTER_FRAME, titleScreenEnterFrame);
+				Game.stage.addEventListener(Event.ENTER_FRAME, enterFrame);
+			}
 		}
 		
 		private function enterFrame(e:Event):void

src/ifrit/Enemy.as

 		 * Attepmt to attack player if on the same platform
 		 */
 		private function beginOffense():void
-		{			
+		{
 			if (!fleeMode)
 			{
-				if (this.homeRect.contains(Game.man.x, Game.man.y) && !Game.man.isDestroyed && Game.man.y <= this.y + this.height / 2)
+				if (this.homeRect.contains(Game.man.x, Game.man.y) && !Game.man.isDestroyed)// && Game.man.y <= this.y + this.height / 2)
 				{
 					if (wallIsOccluding())
 						return;
 				}
 				
 				
-				if (Point.distance(new Point(this.x, this.y), new Point(Game.man.x, Game.man.y)) > this.collisionHull.width)
+				if (Point.distance(new Point(this.x, this.y), new Point(Game.man.x, Game.man.y)) <= ((this.collisionHull.width / 2) + (Game.man.collisionHull.width / 2) + 10)) // a little extra padding
 				{
 					if (!(behaviorFlags & NO_MELEE) > 0)
 					{

src/ifrit/Player.as

 		
 		public function Player(x:Number, y:Number, type:uint)
 		{
+			destroyed = false;
+			
 			var animationName:String;
 			var frameWidth:int = 18;
 			var frameHeight:int = 25;
 		{			
 			if (HUD.healthAmount <= 0)
 			{
-				this.destroy();
-				this.graphic.play("death");
+				if (this.classType != Player.NONE)
+				{
+					this.destroy();
+					this.graphic.play("death");
+				}
 			}
 			
 			super.think();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.