Skip to content
Browse files

Initial commit.

  • Loading branch information...
1 parent 2a66cc7 commit 4b504c766a95dd1dfc46d9fbf6917d18d0703ad4 @gamesbyangelina gamesbyangelina committed Dec 3, 2012
Showing with 1,027 additions and 1 deletion.
  1. +11 −1 README.md
  2. +14 −0 noseandtail-android/.classpath
  3. +33 −0 noseandtail-android/.project
  4. +4 −0 noseandtail-android/.settings/org.eclipse.jdt.core.prefs
  5. +24 −0 noseandtail-android/AndroidManifest.xml
  6. BIN noseandtail-android/assets/images1.png
  7. BIN noseandtail-android/assets/nat1.mp3
  8. BIN noseandtail-android/assets/nat2.mp3
  9. +47 −0 noseandtail-android/assets/pack
  10. BIN noseandtail-android/assets/pickup1.wav
  11. BIN noseandtail-android/assets/pickup2.wav
  12. BIN noseandtail-android/images/bottle.png
  13. BIN noseandtail-android/images/box-strip.png
  14. BIN noseandtail-android/images/exit-nose.png
  15. BIN noseandtail-android/images/exit-tail.png
  16. BIN noseandtail-android/images/player-strip.png
  17. BIN noseandtail-android/images/tiles.png
  18. +40 −0 noseandtail-android/proguard.cfg
  19. +11 −0 noseandtail-android/project.properties
  20. +11 −0 noseandtail-android/src/net/cutgar/nat/MainActivity.java
  21. +14 −0 noseandtail-desktop/.classpath
  22. +24 −0 noseandtail-desktop/.project
  23. +11 −0 noseandtail-desktop/.settings/org.eclipse.jdt.core.prefs
  24. +21 −0 noseandtail-desktop/src/net/cutgar/nat/Main.java
  25. +9 −0 noseandtail/.classpath
  26. +17 −0 noseandtail/.project
  27. +11 −0 noseandtail/.settings/org.eclipse.jdt.core.prefs
  28. +57 −0 noseandtail/src/net/cutgar/nat/AFBox.java
  29. +14 −0 noseandtail/src/net/cutgar/nat/Bottle.java
  30. +20 −0 noseandtail/src/net/cutgar/nat/Exit.java
  31. +278 −0 noseandtail/src/net/cutgar/nat/LevelGen.java
  32. +11 −0 noseandtail/src/net/cutgar/nat/NoseAndTail.java
  33. +160 −0 noseandtail/src/net/cutgar/nat/PlayState.java
  34. +82 −0 noseandtail/src/net/cutgar/nat/Player.java
  35. +9 −0 noseandtail/src/net/cutgar/nat/Registry.java
  36. +38 −0 noseandtail/src/net/cutgar/nat/juice/TweenArrive.java
  37. +37 −0 noseandtail/src/net/cutgar/nat/juice/TweenBounce.java
  38. +19 −0 noseandtail/src/net/cutgar/nat/juice/TweenTarget.java
View
12 README.md
@@ -1,4 +1,14 @@
noseandtail
===========
-Nose And Tail is a four-word-game-jam game I made in about three hours. Everything is public domain. Requires LibGDX and flixel-android to run.
+Nose And Tail is a four-word-game-jam game I made in about three hours. Everything is public domain. Requires LibGDX and flixel-android to run.
+
+The music is generated using autotracker-bu which you can get... somewhere on GitHub. I can't remember exactly where, unfortunately but I'll try and find it and link it in.
+
+Really horrible code, hacked together, but might be of some use. Art and code are entirely public domain should anyone ever find it of use. In order to compile and run, you will need LibGDX libs and flixel-android, which you can get from here: http://forums.flixel.org/index.php?topic=6820.0 or (up to date) here: http://code.google.com/p/flixel-android/
+
+If you just want to play the game (god forbid) go here: http://www.cutgar.net/4wgj/nose-and-tail.zip
+
+If you want to ask me why I did this: mike @ cutgar.net
+
+Thanks!
View
14 noseandtail-android/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/noseandtail"/>
+ <classpathentry kind="lib" exported="true" path="/noseandtail/libs/gdx.jar" sourcepath="/noseandtail/libs/gdx-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="/noseandtail/libs/gdx-freetype.jar" sourcepath="/noseandtail/libs/gdx-freetype-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="libs/gdx-backend-android.jar" sourcepath="libs/gdx-backend-android-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="/noseandtail/libs/flixel.jar" sourcepath="/noseandtail/libs/flixel-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="libs/flixel-android.jar" sourcepath="libs/flixel-android-sources.jar"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
View
33 noseandtail-android/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>noseandtail-android</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
4 noseandtail-android/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
View
24 noseandtail-android/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="net.cutgar.nat"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:screenOrientation="landscape"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
View
BIN noseandtail-android/assets/images1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/assets/nat1.mp3
Binary file not shown.
View
BIN noseandtail-android/assets/nat2.mp3
Binary file not shown.
View
47 noseandtail-android/assets/pack
@@ -0,0 +1,47 @@
+
+images1.png
+format: RGBA8888
+filter: Nearest,Nearest
+repeat: none
+box-strip
+ rotate: false
+ xy: 2, 2
+ size: 80, 32
+ orig: 80, 32
+ offset: 0, 0
+ index: -1
+player-strip
+ rotate: false
+ xy: 84, 2
+ size: 144, 16
+ orig: 144, 16
+ offset: 0, 0
+ index: -1
+bottle
+ rotate: false
+ xy: 2, 36
+ size: 64, 16
+ orig: 64, 16
+ offset: 0, 0
+ index: -1
+tiles
+ rotate: false
+ xy: 2, 54
+ size: 32, 16
+ orig: 32, 16
+ offset: 0, 0
+ index: -1
+exit-tail
+ rotate: false
+ xy: 36, 54
+ size: 32, 16
+ orig: 32, 16
+ offset: 0, 0
+ index: -1
+exit-nose
+ rotate: false
+ xy: 2, 72
+ size: 32, 16
+ orig: 32, 16
+ offset: 0, 0
+ index: -1
View
BIN noseandtail-android/assets/pickup1.wav
Binary file not shown.
View
BIN noseandtail-android/assets/pickup2.wav
Binary file not shown.
View
BIN noseandtail-android/images/bottle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/images/box-strip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/images/exit-nose.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/images/exit-tail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/images/player-strip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN noseandtail-android/images/tiles.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
40 noseandtail-android/proguard.cfg
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
View
11 noseandtail-android/project.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-16
View
11 noseandtail-android/src/net/cutgar/nat/MainActivity.java
@@ -0,0 +1,11 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxAndroidApplication;
+
+public class MainActivity extends FlxAndroidApplication
+{
+ public MainActivity()
+ {
+ super(new NoseAndTail());
+ }
+}
View
14 noseandtail-desktop/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="assets"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" path="libs/gdx-backend-lwjgl.jar" sourcepath="libs/gdx-backend-lwjgl-sources.jar"/>
+ <classpathentry kind="lib" path="libs/gdx-backend-lwjgl-natives.jar"/>
+ <classpathentry kind="lib" path="libs/gdx-natives.jar"/>
+ <classpathentry kind="lib" path="libs/gdx-freetype-natives.jar"/>
+ <classpathentry kind="lib" path="libs/flixel-desktop.jar" sourcepath="libs/flixel-desktop-sources.jar"/>
+ <classpathentry kind="lib" path="libs/gdx-tools.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/noseandtail"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
24 noseandtail-desktop/.project
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>noseandtail-desktop</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>assets</name>
+ <type>2</type>
+ <locationURI>PARENT-1-PROJECT_LOC/noseandtail-android/assets</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
View
11 noseandtail-desktop/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
View
21 noseandtail-desktop/src/net/cutgar/nat/Main.java
@@ -0,0 +1,21 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxDesktopApplication;
+
+import com.badlogic.gdx.tools.imagepacker.TexturePacker;
+import com.badlogic.gdx.tools.imagepacker.TexturePacker.Settings;
+
+public class Main
+ {
+ public static void main(String[] args)
+ {
+ Settings settings = new Settings();
+ settings.padding = 2;
+ settings.maxWidth = 512;
+ settings.maxHeight = 512;
+ settings.incremental = true;
+ TexturePacker.process(settings, "../noseandtail-android/images", "../noseandtail-android/assets");
+
+ new FlxDesktopApplication(new NoseAndTail(), 800, 480);
+ }
+}
View
9 noseandtail/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" exported="true" path="libs/gdx.jar" sourcepath="libs/gdx-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="libs/gdx-freetype.jar" sourcepath="libs/gdx-freetype-sources.jar"/>
+ <classpathentry kind="lib" exported="true" path="libs/flixel.jar" sourcepath="libs/flixel-sources.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
17 noseandtail/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>noseandtail</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
11 noseandtail/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
View
57 noseandtail/src/net/cutgar/nat/AFBox.java
@@ -0,0 +1,57 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxSprite;
+import org.flixel.FlxTimer;
+
+public class AFBox extends FlxSprite {
+
+ public boolean isUsed = false;
+ public boolean willTurnIntoTail = false;
+ public int TAIL_COLOUR = 0xff9e935d;
+ public int NOSE_COLOUR = 0xff9e61ee;
+ protected FlxTimer switchCostumeTimer;
+
+ public AFBox(int x, int y){
+ super(x * Registry.TS, y*Registry.TS);
+ loadGraphic("pack:box-strip", true, true, 16, 32);
+ addAnimation("tail", new int[]{0});
+ addAnimation("nose", new int[]{1});
+ addAnimation("tail-used", new int[]{3});
+ addAnimation("nose-used", new int[]{4});
+ play("nose");
+ immovable = true;
+
+ }
+
+ public AFBox(int x, int y, boolean tail){
+ super(x * Registry.TS, y*Registry.TS);
+ loadGraphic("pack:box-strip", true, true, 16, 32);
+ addAnimation("tail", new int[]{0});
+ addAnimation("nose", new int[]{1});
+ addAnimation("tail-used", new int[]{3});
+ addAnimation("nose-used", new int[]{4});
+ if(tail)
+ play("tail");
+ else
+ play("nose");
+
+ willTurnIntoTail = tail;
+ immovable = true;
+ }
+
+ public void used(){
+ isUsed = true;
+ if(willTurnIntoTail)
+ play("tail-used");
+ else
+ play("nose-used");
+ }
+
+ @Override
+ public void update(){
+ super.update();
+ if(switchCostumeTimer != null)
+ switchCostumeTimer.update();
+ }
+
+}
View
14 noseandtail/src/net/cutgar/nat/Bottle.java
@@ -0,0 +1,14 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxSprite;
+
+public class Bottle extends FlxSprite {
+
+ public Bottle(int x, int y){
+ super(x*Registry.TS, y*Registry.TS);
+ loadGraphic("pack:bottle", true, false, 16, 16);
+ addAnimation("float", new int[]{0,1,2,3}, 8, true);
+ play("float");
+ }
+
+}
View
20 noseandtail/src/net/cutgar/nat/Exit.java
@@ -0,0 +1,20 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxSprite;
+
+public class Exit extends FlxSprite {
+
+ boolean isTail;
+
+ public Exit(int x, int y, boolean tailExit){
+ super(x*Registry.TS, y*Registry.TS);
+ this.isTail = tailExit;
+ if(tailExit)
+ loadGraphic("pack:exit-tail");
+ else
+ loadGraphic("pack:exit-nose");
+ immovable = true;
+ }
+
+
+}
View
278 noseandtail/src/net/cutgar/nat/LevelGen.java
@@ -0,0 +1,278 @@
+package net.cutgar.nat;
+
+import java.util.LinkedList;
+
+import net.cutgar.nat.juice.TweenArrive;
+import net.cutgar.nat.juice.TweenTarget;
+
+import org.flixel.FlxG;
+import org.flixel.FlxGroup;
+import org.flixel.FlxText;
+import org.flixel.FlxTileblock;
+import org.flixel.FlxTilemap;
+
+public class LevelGen {
+
+
+ public static int PURPLE_BRIGHT = 0xff9E469C;
+ public static int FISH_BASE = 0xff9E935D;
+
+ public static void GenLevel(PlayState s, int level){
+ s.tweens = new LinkedList<TweenTarget>();
+ s.blocks = new FlxGroup();
+ s.boxes = new FlxGroup();
+ s.bottles = new FlxGroup();
+
+ if(level == 0){
+ FlxText title = new FlxText(0, 0, FlxG.width);
+ title.setText("NOSE & TAIL: COSTUMED CRUSADER");
+ title.setFormat(title.getFont(), 16, PURPLE_BRIGHT, "left");
+ s.add(title);
+
+ FlxText subtitle = new FlxText(0, 16, FlxG.width);
+ subtitle.setText("Being the tale of an action figure leading a double life");
+ subtitle.setFormat(subtitle.getFont(), 8, PURPLE_BRIGHT, "left");
+ s.add(subtitle);
+
+ FlxTileblock floor = new FlxTileblock(0, FlxG.height - 16, FlxG.width, 16);
+ floor.makeGraphic(FlxG.width, 16, PURPLE_BRIGHT);
+ s.blocks.add(floor);
+ floor = new FlxTileblock(0, 32, 16, FlxG.height-32);
+ floor.makeGraphic(16, FlxG.height-32, PURPLE_BRIGHT);
+ s.blocks.add(floor);
+ floor = new FlxTileblock(FlxG.width-16, 32, 16, FlxG.height-32);
+ floor.makeGraphic(16, FlxG.height-32, PURPLE_BRIGHT);
+ s.blocks.add(floor);
+
+ s.boxes.add(new AFBox(10, 12, true));
+
+ FlxText tweenIn = new FlxText(FlxG.width+10, 11*Registry.TS, FlxG.width);
+ tweenIn.setText("Press 'UP' at a box to swap costume");
+ tweenIn.setFormat(tweenIn.getFont(), 8, PURPLE_BRIGHT, "left");
+ s.add(tweenIn);
+ s.tweens.add(new TweenArrive(tweenIn, 7*Registry.TS, 0.03f, false));
+ tweenIn = new FlxText(FlxG.width*2, 12*Registry.TS, FlxG.width);
+ tweenIn.setText("Get to the exit in the right costume.");
+ tweenIn.setFormat(tweenIn.getFont(), 8, FISH_BASE, "left");
+ s.add(tweenIn);
+ s.tweens.add(new TweenArrive(tweenIn, 12*Registry.TS, 0.03f, false));
+
+ s.add(s.blocks);
+ s.add(s.boxes);
+
+ s.add(Registry.player = new Player(3, 3));
+ s.add(Registry.exit = new Exit(16, 13, true));
+ return;
+ }
+ else if(level == 1){
+ FlxText title = new FlxText(0, 0, FlxG.width);
+ title.setText("A BEACHED TAIL");
+ title.setFormat(title.getFont(), 16, FISH_BASE, "left");
+ s.add(title);
+
+ FlxText subtitle = new FlxText(0, 16, FlxG.width);
+ subtitle.setText("Nose's costume is heavy, so you can't jump as high.");
+ subtitle.setFormat(subtitle.getFont(), 8, FISH_BASE, "left");
+ s.add(subtitle);
+
+ s.tiles = new FlxTilemap();
+ s.tiles.loadMap(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1\n" +
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
+ , "pack:tiles");
+ s.add(s.tiles);
+
+ s.boxes.add(new AFBox(19,10, true));
+ s.add(s.boxes);
+
+ s.add(Registry.player = new Player(3, 3));
+ s.add(Registry.exit = new Exit(18, 4, true));
+ return;
+ }
+ else if(level == 2){
+ FlxText title = new FlxText(0, 0, FlxG.width);
+ title.setText("TOOTH AND TAIL");
+ title.setFormat(title.getFont(), 16, FISH_BASE, "left");
+ s.add(title);
+
+ FlxText subtitle = new FlxText(0, 16, FlxG.width);
+ subtitle.setText("Only Nose can collect the bottles!");
+ subtitle.setFormat(subtitle.getFont(), 8, FISH_BASE, "left");
+ s.add(subtitle);
+
+ s.tiles = new FlxTilemap();
+ s.tiles.loadMap(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1\n" +
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1\n" +
+ "1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
+ , "pack:tiles");
+ s.add(s.tiles);
+
+ FlxText tweenIn = new FlxText(FlxG.width+10, 8*Registry.TS, FlxG.width);
+ tweenIn.setText("You need all the bottles to exit.");
+ tweenIn.setFormat(tweenIn.getFont(), 8, FISH_BASE, "left");
+ s.add(tweenIn);
+ s.tweens.add(new TweenArrive(tweenIn, 5*Registry.TS, 0.04f, false));
+
+ s.bottles.add(new Bottle(10, 7));
+ s.bottles.add(new Bottle(11, 7));
+ s.bottles.add(new Bottle(12, 7));
+
+ s.bottles.add(new Bottle(19, 4));
+ s.bottles.add(new Bottle(20, 4));
+ s.add(s.bottles);
+
+ s.boxes.add(new AFBox(21,3, false));
+ s.boxes.add(new AFBox(21,10, true));
+ s.add(s.boxes);
+
+ s.add(Registry.player = new Player(3, 10));
+ s.add(Registry.exit = new Exit(8, 7, false));
+ return;
+ }
+ else if(level == 3){
+ FlxText title = new FlxText(0, 0, FlxG.width);
+ title.setText("TAIL NOSE BEST");
+ title.setFormat(title.getFont(), 16, FISH_BASE, "left");
+ s.add(title);
+
+ FlxText subtitle = new FlxText(0, 16, FlxG.width);
+ subtitle.setText("You can only use a costume box once...");
+ subtitle.setFormat(subtitle.getFont(), 8, FISH_BASE, "left");
+ s.add(subtitle);
+
+ s.tiles = new FlxTilemap();
+ s.tiles.loadMap(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1\n" +
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,1,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
+ , "pack:tiles");
+ s.add(s.tiles);
+
+ FlxText restart = new FlxText(15*Registry.TS, 13*Registry.TS, FlxG.width);
+ restart.setFormat(restart.getFont(), 8, FISH_BASE, "left");
+ restart.setText("Press R to restart");
+ s.add(restart);
+
+ s.bottles.add(new Bottle(5, 7));
+ s.bottles.add(new Bottle(6, 7));
+ s.bottles.add(new Bottle(7, 7));
+
+ s.bottles.add(new Bottle(11, 7));
+ s.bottles.add(new Bottle(12, 7));
+ s.bottles.add(new Bottle(13, 7));
+ s.bottles.add(new Bottle(14, 7));
+ s.bottles.add(new Bottle(13, 4));
+ s.bottles.add(new Bottle(14, 4));
+ s.bottles.add(new Bottle(15, 4));
+ s.add(s.bottles);
+
+ s.boxes.add(new AFBox(8,6, false));
+ s.boxes.add(new AFBox(21,10, true));
+ s.add(s.boxes);
+
+ s.add(Registry.player = new Player(21, 4));
+ s.add(Registry.exit = new Exit(10, 13, false));
+ return;
+ }
+ else if(level == 4){
+ FlxText title = new FlxText(0, 0, FlxG.width);
+ title.setText("TAIL AND ERROR");
+ title.setFormat(title.getFont(), 16, FISH_BASE, "left");
+ s.add(title);
+
+ FlxText subtitle = new FlxText(0, 16, FlxG.width);
+ subtitle.setText("Press R to restart");
+ subtitle.setFormat(subtitle.getFont(), 8, FISH_BASE, "left");
+ s.add(subtitle);
+
+ s.tiles = new FlxTilemap();
+ s.tiles.loadMap(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1\n" +
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1\n" +
+ "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
+ , "pack:tiles");
+ s.add(s.tiles);
+
+ s.bottles.add(new Bottle(4, 4));
+ s.bottles.add(new Bottle(5, 4));
+ s.bottles.add(new Bottle(6, 4));
+ s.bottles.add(new Bottle(11, 4));
+ s.bottles.add(new Bottle(12, 4));
+ s.bottles.add(new Bottle(13, 4));
+ s.bottles.add(new Bottle(14, 4));
+ s.bottles.add(new Bottle(21, 4));
+ s.bottles.add(new Bottle(22, 4));
+
+ s.bottles.add(new Bottle(6, 7));
+ s.bottles.add(new Bottle(7, 7));
+ s.bottles.add(new Bottle(8, 7));
+
+ s.bottles.add(new Bottle(15, 11));
+ s.bottles.add(new Bottle(16, 11));
+ s.bottles.add(new Bottle(17, 11));
+ s.bottles.add(new Bottle(13, 4));
+ s.bottles.add(new Bottle(14, 4));
+ s.bottles.add(new Bottle(15, 4));
+ s.add(s.bottles);
+
+ s.boxes.add(new AFBox(9,6, false));
+ s.boxes.add(new AFBox(21,10, true));
+ s.add(s.boxes);
+
+ s.add(Registry.player = new Player(2, 4));
+ s.add(Registry.exit = new Exit(2, 13, false));
+ return;
+ }
+ }
+
+}
View
11 noseandtail/src/net/cutgar/nat/NoseAndTail.java
@@ -0,0 +1,11 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxGame;
+
+public class NoseAndTail extends FlxGame
+{
+ public NoseAndTail()
+ {
+ super(400, 240, PlayState.class, 2, 50, 50, false, 800, 480);
+ }
+}
View
160 noseandtail/src/net/cutgar/nat/PlayState.java
@@ -0,0 +1,160 @@
+package net.cutgar.nat;
+
+import java.util.Iterator;
+import java.util.List;
+
+import net.cutgar.nat.juice.TweenTarget;
+
+import org.flixel.FlxBasic;
+import org.flixel.FlxG;
+import org.flixel.FlxGroup;
+import org.flixel.FlxObject;
+import org.flixel.FlxState;
+import org.flixel.FlxText;
+import org.flixel.FlxTilemap;
+import org.flixel.FlxTimer;
+import org.flixel.event.AFlxCamera;
+import org.flixel.event.AFlxCollision;
+import org.flixel.event.AFlxTimer;
+
+public class PlayState extends FlxState {
+ FlxGroup blocks;
+ FlxGroup boxes;
+ FlxGroup bottles;
+
+ public int level;
+ public List<TweenTarget> tweens;
+ public FlxTilemap tiles;
+
+ public PlayState(){
+ super();
+ this.level = 0;
+ }
+
+ public PlayState(int level){
+ this.level = level;
+ }
+
+ @Override
+ public void create(){
+ FlxG.setBgColor(0xffBDAEB6);
+
+ if(level % 2 == 0)
+ FlxG.playMusic("nat1.mp3");
+ else
+ FlxG.playMusic("nat2.mp3");
+
+ if(level < 5)
+ LevelGen.GenLevel(this, level);
+ else{
+ FlxText over = new FlxText(0, FlxG.height/3, FlxG.width);
+ over.setText("NOSE AND TAIL: COMPLETE");
+ over.setFormat(over.getFont(), 16, LevelGen.PURPLE_BRIGHT, "center");
+ add(over);
+
+ over = new FlxText(0, 2*FlxG.height/3, FlxG.width);
+ over.setText("Knocked together in about three hours for a four-word-game-jam.\nWords were: FISHERMAN/WINE_TASTER/ACTION_FIGURE/DISCOMBOBULATING\nThanks for playing! Let me know what you thought.\nhttp://www.cutgar.net and mike@cutgar.net");
+ over.setFormat(over.getFont(), 8, LevelGen.PURPLE_BRIGHT, "center");
+ add(over);
+ }
+ }
+
+ @Override
+ public void update(){
+ super.update();
+
+ if(level == 5){
+ if(FlxG.keys.any())
+ System.exit(0);
+ return;
+ }
+
+ if(FlxG.keys.R){
+ FlxG.switchState(new PlayState(level));
+ }
+
+ for(TweenTarget t : tweens){
+ t.doTween();
+ }
+
+ if(blocks != null && blocks.length > 0){
+ FlxG.collide(blocks, Registry.player);
+ FlxG.collide(blocks, Registry.exit);
+ }
+ else{
+ FlxG.collide(tiles, Registry.player);
+ FlxG.collide(tiles, Registry.exit);
+ }
+
+ FlxG.overlap(Registry.player, bottles, new AFlxCollision(){
+
+ @Override
+ public void callback(FlxObject player_o, FlxObject bottle_o){
+ Player p = (Player) player_o;
+ Bottle b = (Bottle) bottle_o;
+ if(!p.isTail){
+ b.kill();
+ //Play a sound effect
+ if(Math.random() > 0.5)
+ FlxG.play("pickup1.wav");
+ else
+ FlxG.play("pickup2.wav");
+ }
+ }
+
+ });
+
+ if(gotAllBottles()){
+ FlxG.collide(Registry.exit, Registry.player, new AFlxCollision(){
+ @Override
+ public void callback(FlxObject exit_o, FlxObject player_o){
+ Exit exit = (Exit) exit_o;
+ Player player = (Player) player_o;
+ if(exit.isTail == player.isTail){
+ FlxG.fade(0xff000000, 1.0f, new AFlxCamera(){
+ @Override
+ public void callback(){
+ FlxG.switchState(new PlayState(level+1));
+ }
+ });
+ }
+ }
+ });
+ }
+ else{
+ FlxG.collide(Registry.player, Registry.exit);
+ }
+ if(FlxG.keys.UP){
+ FlxG.overlap(boxes, Registry.player, new AFlxCollision() {
+ @Override
+ public void callback(FlxObject box_o, FlxObject player_o){
+ final AFBox box = (AFBox) box_o;
+ final Player player = (Player) player_o;
+ if (box.isUsed || box.willTurnIntoTail == player.isTail)
+ return;
+
+ Registry.player.kill();
+ box.switchCostumeTimer = new FlxTimer();
+ box.used();
+ box.switchCostumeTimer.start(0.5f, 1, new AFlxTimer() {
+
+ @Override
+ public void callback(FlxTimer Timer){
+ Registry.player.switchCostume();
+ Registry.player.revive();
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private boolean gotAllBottles(){
+ Iterator<FlxBasic> it = bottles.members.iterator();
+ while(it.hasNext()){
+ if(it.next().alive)
+ return false;
+ }
+ return true;
+ }
+}
View
82 noseandtail/src/net/cutgar/nat/Player.java
@@ -0,0 +1,82 @@
+package net.cutgar.nat;
+
+import org.flixel.FlxG;
+import org.flixel.FlxObject;
+import org.flixel.FlxSprite;
+
+public class Player extends FlxSprite {
+
+ public boolean isTail = false;
+ public int TAIL_COLOUR = 0xff9e935d;
+ public int NOSE_COLOUR = 0xff9e61ee;
+
+ public Player(int x, int y){
+ super(x*Registry.TS, y*Registry.TS);
+ loadGraphic("pack:player-strip", true, true, 16);
+ addAnimation("idle", new int[]{0,2}, 2, true);
+ addAnimation("walk", new int[]{0,1,2,3}, 8, true);
+ addAnimation("jump", new int[]{4}, 1, true);
+ addAnimation("idle-tail", new int[]{5});
+ addAnimation("walk-tail", new int[]{5,6,7}, 8, true);
+ addAnimation("jump-tail", new int[]{8});
+
+ play("idle");
+ acceleration.y = 400;
+ }
+
+ @Override
+ public void update(){
+
+ if(FlxG.keys.LEFT){
+ velocity.x = -100;
+ setFacing(FlxObject.LEFT);
+ }
+ else if(FlxG.keys.RIGHT){
+ velocity.x = 100;
+ setFacing(FlxObject.RIGHT);
+ }
+ else{
+ velocity.x = 0;
+ }
+
+ if(FlxG.keys.SPACE && isTouching(FlxObject.FLOOR)){
+ if(!isTail)
+ velocity.y = -150;
+ else
+ velocity.y = -250;
+ }
+
+ if(FlxG.keys.X){
+// play("attack");
+// attacking = true;
+ }
+ else{
+// attacking = false;
+
+ if(velocity.y != 0){
+ if(isTail)
+ play("jump-tail");
+ else
+ play("jump");
+ }
+ else if(velocity.x != 0){
+ if(isTail)
+ play("walk-tail");
+ else
+ play("walk");
+ }
+ else{
+ if(isTail)
+ play("idle-tail");
+ else
+ play("idle");
+ }
+
+ }
+
+ }
+
+ public void switchCostume(){
+ isTail = !isTail;
+ }
+}
View
9 noseandtail/src/net/cutgar/nat/Registry.java
@@ -0,0 +1,9 @@
+package net.cutgar.nat;
+
+public class Registry {
+
+ public static int TS = 16;
+ public static Player player;
+ public static Exit exit;
+
+}
View
38 noseandtail/src/net/cutgar/nat/juice/TweenArrive.java
@@ -0,0 +1,38 @@
+package net.cutgar.nat.juice;
+
+import org.flixel.FlxObject;
+
+public class TweenArrive extends TweenTarget {
+
+ float speed;
+ private boolean vertical;
+ boolean done = false;
+ float delta = 0.01f;
+
+ public TweenArrive(FlxObject b, float target, float speed, boolean vertical){
+ super(b, target);
+ this.speed = speed;
+ this.vertical = vertical;
+ }
+
+ @Override
+ public void doTween(){
+ if(done)
+ return;
+ if(vertical){
+ basic.y += speed * (target - basic.y);
+ if(Math.abs(target - basic.y) < delta){
+ basic.y = target;
+ done = true;
+ }
+ }
+ else{
+ basic.x += speed * (target - basic.x);
+ if(Math.abs(target - basic.x) < delta){
+ basic.x = target;
+ done = true;
+ }
+ }
+ }
+
+}
View
37 noseandtail/src/net/cutgar/nat/juice/TweenBounce.java
@@ -0,0 +1,37 @@
+package net.cutgar.nat.juice;
+
+import org.flixel.FlxObject;
+
+public class TweenBounce extends TweenTarget {
+
+ float spill;
+ float nextSpill;
+ boolean pos;
+ float tolerance = 1f;
+
+ public TweenBounce(FlxObject b, float target, float overSpillProportion){
+ super(b, target);
+ this.spill = overSpillProportion;
+ float abs = target - b.y;
+ if(abs > 0){ //basic is above target
+ nextSpill = target + (abs * spill);
+ }
+ else
+ nextSpill = target + 2 * (abs * spill);
+ pos = abs > 0;
+ }
+
+ @Override
+ public void doTween(){
+ basic.y += 0.2 * (nextSpill - basic.y);
+ if(Math.abs(nextSpill - basic.y) < tolerance){
+ float abs = target - basic.y;
+ if(abs > 0){ //basic is above target
+ nextSpill = target + (abs * spill);
+ }
+ else
+ nextSpill = target + 2 * (abs * spill);
+ }
+ }
+
+}
View
19 noseandtail/src/net/cutgar/nat/juice/TweenTarget.java
@@ -0,0 +1,19 @@
+package net.cutgar.nat.juice;
+
+import org.flixel.FlxObject;
+
+public class TweenTarget {
+
+ protected FlxObject basic;
+ protected float target;
+
+ public TweenTarget(FlxObject b, float target){
+ this.basic = b;
+ this.target = target;
+ }
+
+ public void doTween(){};
+
+
+
+}

0 comments on commit 4b504c7

Please sign in to comment.
Something went wrong with that request. Please try again.