Permalink
Browse files

Merge in basecode from https://github.com/djcsdy/ld-basecode

Conflicts:
	.gitignore
  • Loading branch information...
2 parents af78adc + a5b11c5 commit 087513bf14361b97e3a7e718a688621b8a413540 @djcsdy committed Feb 13, 2012
Showing with 2,366 additions and 667 deletions.
  1. +4 −4 .gitignore
  2. +72 −0 build.xml
  3. +0 −144 lib/ChevyRay-FlashPunk-46c75be/net/flashpunk/Sfx.as
  4. +0 −126 lib/ChevyRay-FlashPunk-46c75be/net/flashpunk/graphics/Text.as
  5. +1 −0 lib/flashpunk/.gitignore
  6. +3 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/README.markdown
  7. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/license.txt
  8. +49 −11 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Engine.as
  9. +84 −63 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Entity.as
  10. +110 −22 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/FP.as
  11. +0 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Graphic.as
  12. +12 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Mask.as
  13. +7 −8 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Screen.as
  14. +258 −0 lib/flashpunk/net/flashpunk/Sfx.as
  15. +14 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Tween.as
  16. +5 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/Tweener.as
  17. +103 −41 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/World.as
  18. +36 −17 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/Console.as
  19. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_debug.png
  20. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_logo.png
  21. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_output.png
  22. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_pause.png
  23. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_play.png
  24. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/debug/console_step.png
  25. BIN lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/04B_03__.TTF
  26. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Anim.as
  27. +3 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Backdrop.as
  28. +66 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Canvas.as
  29. +27 −9 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Emitter.as
  30. +3 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Graphiclist.as
  31. +160 −58 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Image.as
  32. +3 −4 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Particle.as
  33. +18 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/ParticleType.as
  34. +4 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/PreRotation.as
  35. +12 −12 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Spritemap.as
  36. +13 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Stamp.as
  37. +495 −0 lib/flashpunk/net/flashpunk/graphics/Text.as
  38. +6 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/TiledImage.as
  39. +8 −4 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/TiledSpritemap.as
  40. +182 −16 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/graphics/Tilemap.as
  41. +112 −6 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/masks/Grid.as
  42. +13 −8 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/masks/Hitbox.as
  43. +20 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/masks/Masklist.as
  44. +33 −4 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/masks/Pixelmask.as
  45. +1 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/Alarm.as
  46. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/AngleTween.as
  47. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/ColorTween.as
  48. +1 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/MultiVarTween.as
  49. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/NumTween.as
  50. +2 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/misc/VarTween.as
  51. +1 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/CircularMotion.as
  52. +0 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/CubicMotion.as
  53. +0 −2 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/LinearMotion.as
  54. +17 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/LinearPath.as
  55. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/Motion.as
  56. +2 −2 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/QuadMotion.as
  57. +1 −1 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/motion/QuadPath.as
  58. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/sound/Fader.as
  59. 0 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/tweens/sound/SfxFader.as
  60. +4 −5 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/utils/Data.as
  61. +58 −28 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/utils/Draw.as
  62. +1 −2 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/utils/Ease.as
  63. +44 −10 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/utils/Input.as
  64. +2 −3 lib/{ChevyRay-FlashPunk-46c75be → flashpunk}/net/flashpunk/utils/Key.as
  65. BIN lib/flexTasks.jar
  66. +26 −0 src/net/noiseinstitute/basecode/Range.as
  67. +10 −0 src/net/noiseinstitute/basecode/Static.as
  68. +26 −0 src/net/noiseinstitute/basecode/Trig.as
  69. +123 −0 src/net/noiseinstitute/basecode/VectorMath.as
  70. +111 −0 src/net/noiseinstitute/youarenowinspace/Preloader.as
View
@@ -1,10 +1,10 @@
-
-/youarenowinspace.iml
/.idea
+*.iml
+/out
+*~
+/build
/.actionScriptProperties
/.project
/.settings
/bin-debug
/html-template
-
-/out
View
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="You Are Now In Space" default="build">
+
+ <property name="preloader.class"
+ value="net.noiseinstitute.youarenowinspace.Preloader"/>
+ <property name="main.class"
+ value="net.noiseinstitute.youarenowinspace.Main"/>
+
+ <property name="minimum.ant.version" value="1.8.0"/>
+
+ <property environment="env"/>
+
+ <property name="FLEX_HOME" location="${env.FLEX_HOME}"/>
+
+ <property name="src.dir" location="src"/>
+ <property name="lib.dir" location="lib"/>
+ <property name="build.dir" location="build"/>
+
+ <property name="lib.flextasks" location="${lib.dir}/flexTasks.jar"/>
+ <property name="lib.flashpunk.dir" location="${lib.dir}/flashpunk"/>
+
+
+ <antversion property="ant.version.sufficient"
+ atleast="${minimum.ant.version}"/>
+
+ <fail unless="ant.version.sufficient">
+ Ant ${minimum.ant.version} is required
+ </fail>
+
+
+ <fail message='Flex not found.&#xa;
+ &#xa;
+ You must set either the environment variable "FLEX_HOME"&#xa;
+ or the Ant property "FLEX_HOME" to the directory where the Flex&#xa;
+ SDK is installed.&#xa;
+ &#xa;
+ For example: ant -DFLEX_HOME=C:\Flex&#xa;'>
+ <condition>
+ <not>
+ <available file="${FLEX_HOME}" type="dir"/>
+ </not>
+ </condition>
+ </fail>
+
+
+ <taskdef resource="flexTasks.tasks" classpath="${lib.flextasks}"/>
+
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="build">
+ <pathconvert property="preloader.file">
+ <mapper>
+ <unpackagemapper from="${src.dir}/*" to="${src.dir}/*.as"
+ handledirsep="true"/>
+ </mapper>
+ <path path="${src.dir}/${preloader.class}"/>
+ </pathconvert>
+
+ <mxmlc file="${preloader.file}"
+ output="${build.dir}/Release.swf"
+ debug="false" strict="true">
+ <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
+ <source-path path-element="${src.dir}"/>
+ <source-path path-element="${lib.flashpunk.dir}"/>
+ <source-path path-element="${FLEX_HOME}/frameworks"/>
+ <frame label="start" className="${main.class}"/>
+ </mxmlc>
+ </target>
+</project>
@@ -1,144 +0,0 @@
-package net.flashpunk
-{
- import flash.events.Event;
- import flash.media.Sound;
- import flash.media.SoundChannel;
- import flash.media.SoundTransform;
- import flash.utils.Dictionary;
-
- /**
- * Sound effect object used to play embedded sounds.
- */
- public class Sfx
- {
- /**
- * Optional callback function for when the sound finishes playing.
- */
- public var complete:Function;
-
- /**
- * Creates a sound effect from an embedded source. Store a reference to
- * this object so that you can play the sound using play() or loop().
- * @param source The embedded sound class to use.
- * @param complete Optional callback function for when the sound finishes playing.
- */
- public function Sfx(source:Class, complete:Function = null)
- {
- _sound = _sounds[source];
- if (!_sound) _sound = _sounds[source] = new source;
- this.complete = complete;
- }
-
- /**
- * Plays the sound once.
- * @param vol Volume factor, a value from 0 to 1.
- * @param pan Panning factor, a value from -1 to 1.
- */
- public function play(vol:Number = 1, pan:Number = 0):void
- {
- if (_channel) stop();
- _vol = _transform.volume = vol < 0 ? 0 : vol;
- _pan = _transform.pan = pan < -1 ? -1 : (pan > 1 ? 1 : pan);
- _channel = _sound.play(0, 0, _transform);
- _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
- _looping = false;
- _position = 0;
- }
-
- /**
- * Plays the sound looping. Will loop continuously until you call stop(), play(), or loop() again.
- * @param vol Volume factor, a value from 0 to 1.
- * @param pan Panning factor, a value from -1 to 1.
- */
- public function loop(vol:Number = 1, pan:Number = 0):void
- {
- play(vol, pan);
- _looping = true;
- }
-
- /**
- * Stops the sound if it is currently playing.
- * @return
- */
- public function stop():Boolean
- {
- if (!_channel) return false;
- _position = _channel.position;
- _channel.removeEventListener(Event.SOUND_COMPLETE, onComplete);
- _channel.stop();
- _channel = null;
- return true;
- }
-
- /**
- * Resumes the sound from the position stop() was called on it.
- */
- public function resume():void
- {
- _channel = _sound.play(_position, 0, _transform);
- _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
- _position = 0;
- }
-
- /** @private Event handler for sound completion. */
- private function onComplete(e:Event = null):void
- {
- if (_looping) loop(_vol, _pan);
- else stop();
- _position = 0;
- if (complete != null) complete();
- }
-
- /**
- * Alter the volume factor (a value from 0 to 1) of the sound during playback.
- */
- public function get volume():Number { return _vol; }
- public function set volume(value:Number):void
- {
- if (value < 0) value = 0;
- if (!_channel || _vol == value) return;
- _vol = _transform.volume = value;
- _channel.soundTransform = _transform;
- }
-
- /**
- * Alter the panning factor (a value from -1 to 1) of the sound during playback.
- */
- public function get pan():Number { return _pan; }
- public function set pan(value:Number):void
- {
- if (value < -1) value = -1;
- if (value > 1) value = 1;
- if (!_channel || _pan == value) return;
- _pan = _transform.pan = value;
- _channel.soundTransform = _transform;
- }
-
- /**
- * If the sound is currently playing.
- */
- public function get playing():Boolean { return _channel != null; }
-
- /**
- * Position of the currently playing sound, in seconds.
- */
- public function get position():Number { return (_channel ? _channel.position : _position) / 1000; }
-
- /**
- * Length of the sound, in seconds.
- */
- public function get length():Number { return _sound.length / 1000; }
-
- // Sound infromation.
- /** @private */ private var _vol:Number = 1;
- /** @private */ private var _pan:Number = 0;
- /** @private */ private var _sound:Sound;
- /** @private */ private var _channel:SoundChannel;
- /** @private */ private var _transform:SoundTransform = new SoundTransform;
- /** @private */ private var _position:Number = 0;
- /** @private */ private var _looping:Boolean;
-
- // Stored Sound objects.
- /** @private */ private static var _sounds:Dictionary = new Dictionary;
- }
-}
@@ -1,126 +0,0 @@
-package net.flashpunk.graphics
-{
- import flash.display.BitmapData;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import flash.text.TextField;
- import flash.text.TextFormat;
- import flash.text.TextLineMetrics;
- import net.flashpunk.FP;
- import net.flashpunk.Graphic;
-
- /**
- * Used for drawing text using embedded fonts.
- */
- public class Text extends Image
- {
- /**
- * The font to assign to new Text objects.
- */
- public static var font:String = "default";
-
- /**
- * The font size to assign to new Text objects.
- */
- public static var size:uint = 16;
-
- /**
- * Constructor.
- * @param text Text to display.
- * @param x X offset.
- * @param y Y offset.
- * @param width Image width (leave as 0 to size to the starting text string).
- * @param height Image height (leave as 0 to size to the starting text string).
- */
- public function Text(text:String, x:Number = 0, y:Number = 0, width:uint = 0, height:uint = 0)
- {
- _field.embedFonts = true;
- _field.defaultTextFormat = _form = new TextFormat(Text.font, Text.size, 0xFFFFFF);
- _field.text = _text = text;
- if (!width) width = _field.textWidth + 4;
- if (!height) height = _field.textHeight + 4;
- _source = new BitmapData(width, height, true, 0);
- super(_source);
- updateBuffer();
- this.x = x;
- this.y = y;
- }
-
- /** @private Updates the drawing buffer. */
- override public function updateBuffer(clearBefore:Boolean = false):void
- {
- _field.setTextFormat(_form);
- _field.width = _width = _field.textWidth + 4;
- _field.height = _height = _field.textHeight + 4;
- _source.fillRect(_sourceRect, 0);
- _source.draw(_field);
- super.updateBuffer(clearBefore);
- }
-
- /** @private Centers the Text's originX/Y to its center. */
- override public function centerOrigin():void
- {
- originX = _width / 2;
- originY = _height / 2;
- }
-
- /**
- * Text string.
- */
- public function get text():String { return _text; }
- public function set text(value:String):void
- {
- if (_text == value) return;
- _field.text = _text = value;
- updateBuffer();
- }
-
- /**
- * Font family.
- */
- public function get font():String { return _font; }
- public function set font(value:String):void
- {
- if (_font == value) return;
- _form.font = _font = value;
- updateBuffer();
- }
-
- /**
- * Font size.
- */
- public function get size():uint { return _size; }
- public function set size(value:uint):void
- {
- if (_size == value) return;
- _form.size = _size = value;
- updateBuffer();
- }
-
- /**
- * Width of the text image.
- */
- override public function get width():uint { return _width; }
-
- /**
- * Height of the text image.
- */
- override public function get height():uint { return _height; }
-
- // Text information.
- /** @private */ private var _field:TextField = new TextField;
- /** @private */ private var _width:uint;
- /** @private */ private var _height:uint;
- /** @private */ private var _form:TextFormat;
- /** @private */ private var _text:String;
- /** @private */ private var _font:String;
- /** @private */ private var _size:uint;
-
- // Default font family.
- // Use this option when compiling with Flex SDK 3 or lower
- // [Embed(source = '04B_03__.TTF', fontFamily = 'default')]
- // Use this option when compiling with Flex SDK 4
- [Embed(source = '04B_03__.TTF', embedAsCFF="false", fontFamily = 'default')]
- /** @private */ private static var _FONT_DEFAULT:Class;
- }
-}
View
@@ -0,0 +1 @@
+*~
@@ -13,7 +13,7 @@ FEATURES
* Powerful motion tweening for linear, curved, and path-based movement.
* Z-sorted render lists for easy depth management.
* Simple keyboard and mouse input state checking.
-* Quick & efficent particle effects and emitters.
+* Quick & efficient particle effects and emitters.
* Handy console for real-time debugging and information tracking.
OVERVIEW
@@ -32,10 +32,10 @@ Note that a Graphiclist type also exists, which can be assigned to an Entity and
Collision works largely the same, except has also been improved using a component system similar to graphics. All Entity objects still use a Hitbox rectangle as their default collision bounds, but you can assign a specialized Mask to an Entity for more advanced collision. For example, you can assign it a Pixelmask type for pixel-perfect collision, or a Grid type to determine a large area of solid/nonsolid grid cells. This latter type works well in combination with the Tilemap graphic type, allowing a single Entity object to possibly handle an entire scene’s collision and rendering. Using a single Grid mask for collision is significantly faster than using a bunch of invisible Entity objects’ hitboxes.
### TWEENING
-One of FlashPunk’s more specific and powerful features are the new Tween classes. All Entities and Worlds can have any amount of Tweens added to it. Currently the Tweens are divided into 3 categories: motion, sound, and miscellaneous tweens. Motion tweens provide you with a powerful set of objects useful for planned motion. For example, if I wanted an Entity to move from one point to another, I could assign it a LinearMotion tween and have its position sync with that tween’s x and y position when it updates (an Entity’s tweens are updated immediately before the Entity’s update() function itself is called). Classes for curved (quadratic and cubic bezier), paths (linear paths and quadtratic paths), and circular motion are also provided. Tweens can be made even more effective when combined with Easing functions, allowing smooth transitions and other functionality.
+One of FlashPunk’s more specific and powerful features are the new Tween classes. All Entities and Worlds can have any amount of Tweens added to it. Currently the Tweens are divided into 3 categories: motion, sound, and miscellaneous tweens. Motion tweens provide you with a powerful set of objects useful for planned motion. For example, if I wanted an Entity to move from one point to another, I could assign it a LinearMotion tween and have its position sync with that tween’s x and y position when it updates (an Entity’s tweens are updated immediately before the Entity’s update() function itself is called). Classes for curved (quadratic and cubic bezier), paths (linear paths and quadratic paths), and circular motion are also provided. Tweens can be made even more effective when combined with Easing functions, allowing smooth transitions and other functionality.
### DEBUGGING
FlashPunk now has a console which lets you view lots of useful information in real-time, such as FPS, frame timing info, Entity count, and user-logged information. The user can select Entities and move them around while the console is paused, pan the camera, and also view user-specified properties for each Entity in the debug panel.
### AND MORE...
-There are also many other various changes and improvements across the board, all which I cannot list off the top of my head. Suffice to say, version 0.87 has a total of 16 different classes, and the new version has over 40. FlashPunk is still simple to use and prototype in, but with version 1.0 onward, I aim to make it not only effectively simple and fast, but contain powerful and efficent internal systems for those who know how to use them.
+There are also many other various changes and improvements across the board, all which I cannot list off the top of my head. Suffice to say, version 0.87 has a total of 16 different classes, and the new version has over 40. FlashPunk is still simple to use and prototype in, but with version 1.0 onward, I aim to make it not only effectively simple and fast, but contain powerful and efficient internal systems for those who know how to use them.
Oops, something went wrong.

0 comments on commit 087513b

Please sign in to comment.