Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Titch

Pages: [1] 2 3 ... 14
1
help / Re: DAME - a new map editor made using flixel!
« on: Tue, Jul 30, 2013 »
So for the past few days I was struggling to get DAME to work with Axel, due to tile indexing issues; since Axel doesn't include the 0 indexed transparent tile so all the tile ids for the numbered tile where off by 1.

It turns out all I had to do to make it work is go into AxTilemap and comment out one line at 219.
//tid -= 1;

Boom. Now it's working.

2
help / Re: What's the use of FlxG.worldBounds?
« on: Mon, Aug 15, 2011 »
I believe bounds lock the camera scroll area and the quad tree solving area.

3
help / Re: Is there any tutorial about drawing tiles?
« on: Sun, Aug 14, 2011 »
This is the best 'technical' tutorial for drawing tiles. In the sense that it's more about technique than tools:

http://gas13.ru/v3/tutorials/sywtbapa_almighty_grass_tile.php

Strongly recommend at least reading sections 1-4. Shading is a -big deal- when it comes to making tiles so reading this would probably be good too:

http://www.natomic.com/hosted/marks/mpat/shading.html

4
help / Re: Entity ID system implementation
« on: Sun, Aug 14, 2011 »
Oh, one more thing I forgot to mention. You could keep using numeric indexing for objects and just define constants for everything as static constants. So you would have one big static ObjectIDs.as that would look like this

Code: [Select]
public class ObjectIDs
{

public static const SWORD:int = 0;
public static const POTION:int =1;
public static const COIN:int =2;
}

Then whenever you need to make a reference to the object you just use the constant name

Code: [Select]
giveItem(ObjectIDs.SWORD)
There are two issues with this. The first is it creates a huge, hard to maintain class that has to be manually updated every time you add an object (imagine if you need to add something in the middle of the numerical sequance and every object higher has to be bumped up by one). The second is that the constant references are only going to be useful within the scope of the code. If you wanted to parse some kind of external list (from XML or text) you couldn't use the constant referances without making some sort of wacky wrapper function inside ObjectID's that could look up the constant based on a string. Also it's going to mean doing twice as many lookups, as opposed to the single one you would be doing with a class registry

String --> ObjectIDs --> Constant --> ClassRegistry --> Item;

as opposed to

String --> ClassRegistry --> Item;

It is however worth keeping in mind that you could set string constants for objects you refer to alot in code so that you are less likely to screw up the spelling by mistake, or if you do make an error its the same all the way through the code rather than being wrong in just one place. For example:
Code: [Select]
public class ObjectIDs
{

public static const PNEUMONOULTRAMICROSCOPIC-SILICOVOLCANOCONIOSIS:string= "PNEUMONOULTRAMICROSCOPIC-SILICOVOLCANOCONIOSIS";
}

If you make a typo in the constant name then the compiler will stop before compiling the code, and you won't end up with a wacky error at runtime. Also if you use FlashDevelop it will give you code completion too :)

(NB: Yes, I went on Google and looked up 'hardest to spell word' >_>)

5
To keep the offset just use a point storing the distance between the mouse and the object when it's clicked on and then add it back to the position whilst you are dragging it around.

Psuedo code ahead:-
(I've probably screwed up the +/- signs for working out the offset distances)
Code: [Select]
var m_mouseOffset:FlxPoint = new FlxPoint()
var m_isDragged:Boolean

private function onDragInit ():void
{
m_mouseOffset.x = mouse.x - this.x;
m_mouseOffset.y = mouse.y - this.y;
}

public function onDrag()
{
if (m_isDragged)
{
x = mouse.x + mouse_offset.x;
y = mouse.y + mouse_offset.y;
}
else
{
onDragInit()
m_isDragged = true;
}
}

public function onDragRelease():void
{
m_isDragged = false;
m_mouseOffset.x = 0;
m_mouseOffset.y = 0;
}

If you are only dragging on thing at a time you'll only need one instances of offset. Although adding it to every draggable object isn't a massive overhead.

6
Extends FlxGroup. Add the following.

Code: [Select]
public function get x():int { return _x; }

public function set x(value:int):void
{
var diff:int = value - _x;
for each (var item:* in members)
{
if (item is FlxObject)item.x += diff
}
_x = value;
}

public function get y():int { return _y; }

public function set y(value:int):void
{
var diff:int = value - _y;
for each (var item:* in members)
{
if (item is FlxObject)item.y += diff
}
_y = value;
}

It -might- start to lag with a lots of objects since it has to iterate through all the items in members.

7
help / Re: Entity ID system implementation
« on: Sun, Aug 14, 2011 »
There are a lot of options for this.

You could create an object registry. Make a dictionary of strings and associated classes, so you can parse in a string and get an class back (which you can then new() to make a new instance). Something like this:

Quote
public class ClassRegistry
   {
      
      private var store:Dictionary = new Dictionary
      private var warnings:Dictionary = new Dictionary
      
      public function ClassRegistry()
      {
         
      }
      
      public function registerClass ($class:Class, $key:String):void
      {
         trace("registering " + $class +  " at " + $key);
         if ($key in store)
         {
            trace("warning, key overlap, class " + store[$key] + " will be replaced with " + $class);
         }
         store[$key] = $class;
      }
      
      public function getClass ($key:String):Class
      {
         if ($key in store) return store[$key];
         else if (!warnings[$key])
         {
            trace(this + " WARNING : [" + $key + "] not registered with a class, call registerClass first");
            warnings[$key] = true;
         }
         return null;
      }
      
      public function hasClass($key:String):Boolean
      {
         if ($key in store) return true;
         return false;
      }
      
   }

The big annoying downside if that you have to have a register all the strings somewhere when the application starts. But it does mean giving the player an item is going to be readable since you can just write.

giveItem(new registry.getClass("LASER_SWORD"))

This whole solution is a little isn't that elegent and would be a strain on the processor if you gave the player a lot of stuff at once since it's fabricating every single object.

The 'neat' alternative is to extend FlxSprite with some sort of InventoryObject class and make an inventory manager. InventoryObject have their own int variable that tracks the number of that item that is stacked, a boolean to track if they are stackable objects or not and a unique string key that lets you identify the object without needing the class (which could just be a string of the class name, for simplicity).

When the player picks up an object the manager looks in the list of items to see if the player is carrying a stackable version of them same item. If not it just creates adds that item under the key defined in the object. Keep in mind that it's a reference to the same object so if you kill() it somewhere else it might have strange effects. If it -does- find an identical item with the same key it just increases it's stack variable by the amount of the object being added (rather than 50 bullet objects the player has 1 bullet object with a stack value of 50) and trashes the old object.

You could of course combine both to keep the amount of objects created down. So you could store item 'drops' as a list of registry key names and stack counts. Then when the player uses an interaction that requires them to pick up the drops you could created them and parse them into the players inventory manager.

8
I use IDraw http://rpgcrisis.net/forums/files/file/34-idraw/

It's crappy, outdated, poorly translated and has some weird bugs BUT it has tools the most other colour indexed pixel editors don't, like smart area selection. And a really simple and dirty animation preview tool.

I really wish someone would make something new with some of the features IDraw has :)/

9
releases / FlxTimer modification for easier callbacks
« on: Sun, Jul 10, 2011 »
Whilst porting my project from 2.x to 2.5 (an epic undertaking given that I had been working on if for a few months already) I made a little change to the FlxTimer code since the callback was really irritating me since it would cause crashes at runtime.

The change I made was in FlxTimer at line 87, which now looks like this.
Code: [Select]
if (_callback != null)
{
if (_callback.length == 1)_callback(this);
else _callback();

}

10
help / Re: DAME - a new map editor made using flixel!
« on: Tue, Jun 14, 2011 »
Loving Dame 2 stuff. Especially the detchable panels. Very helpfull.

Two features I would still really love to see

1. One button export, I tweak my levels -alot- and it's kind of a pain to have to keep opening that export menu. A quick button or keyboard shortcut would be awesome.

2. A way to revert a fixed tilemap back to a matrix, or swap baked tilemaps using matrices (So I have an area of the level done using a grass tile matrix and I want to swap it for a rock one).

11
help / Re: DAME - a new map editor made using flixel!
« on: Mon, Apr 4, 2011 »
First, just want to say how awesome Dame is. I'm using it for two of my projects at the moment and for the most part it's portability and useablity have been great. I've got a meaty xml exporter script (that sadly I can't share since it's part of my work for an agency :/ ).

Couple of features I would really love to see if Dame 2 is in the works.

- Detachable sprites pane. I lose count of the number of times I realise I can't draw something because I don't have either the tile layer or sprite layer selected since the sprites pane sits in front of the panel frame. Possibly put the sprites and tiles stuff in the same window and have the content toggle when you switch between the two?

- A little optimisation for tile matrix's. They are a god send in themselves (being able to convert ranges back into matrix format would be nice, or save out matrixs in raw form, but I know my limits). Drawing additively is fine, but subtractively carving areas out makes Dame really start to chug.

12
Quote
FlxTimer is used for calling methods when the time is started or completed, otherwise it's useless creating a timer that doesn't do anything.

On the contrary, I've had a least one instance where I didn't need to add callbacks for the timer to be usefull.

In my instance, I wanted something to happen in the update loop as long as a timer was still running (checking player input for a melee attack against a delay timer). So all I needed to do was check timer.finished in the attack function. No need for using any of the callbacks. Thus my suprise when it caused a crash :)

I -could- have switched a bool on and off using callbacks, but that seemed silly since there was one on the timer already.

FlxTimer has been a god send for me, I've got a ton of stuff running timers or activating at a certain time based tick.

13
Just a note. If you make a FlxTimer with no callbacks it causes a crash when the timer tries to update due to a null objects reference (there is no _callbacks for it to get length from. I used this as my solution:

LINE 165:
Code: [Select]
var l:int;
if (_callbacks) l = _callbacks.length;
REPLACING
Code: [Select]
var l:int = _callbacks.length;

14
Thanks for that Wing :)

15
Any chance of posting just the modified code for FlxG and FlxGame?

I'm running a version with some other small hacks in and I don't want to scroll through the whole code making everything match again.

16
help / Re: Constructor vs Create Function
« on: Mon, Mar 14, 2011 »
create() is called once the state has a valid stage reference, I believe. Also things written in the constructor aren't run through the JIT compiler so they run slower.

17
help / Re: An inventory
« on: Mon, Mar 14, 2011 »
Using a vector might be better than a FlxGroup for the purposes of sorting stuff, since if you use a FlxGroup you are locked into using _members to iterate through the contents. If you are doing an inventory I strongly recommend some sort of count on your inventory items so you can stack identical instances to save memory

Code: [Select]

//Begin psudo code
public function addItem ($new_item:Item)
{
for each (var $held_item:Item in inventory)
{
if ($held_item.name == $new_item.name)
{
$held_item.count += $new_item.count;
}
}

18
help / Re: working with images
« on: Wed, Mar 2, 2011 »
Code: [Select]
public function loadGraphic(Graphic:Class,Animated:Boolean=false,Reverse:Boolean=false,Width:uint=0,Height:uint=0,Unique:Boolean=false):FlxSprite
{
_bakedRotation = 0;
_pixels = FlxG.addBitmap(Graphic,Reverse,Unique);

This would probably be a good place to start. Extend FlxSprite and add a new function that works like this one but uses this:

Code: [Select]
loadExternalGraphic(Graphic:Bitmap,Animated:Boolean=false,Reverse:Boolean=false,Width:uint=0,Height:uint=0,Unique:Boolean=false):FlxSprite
{
_bakedRotation = 0;
_pixels = FlxG.addBitmap(Graphic.bitmapData,Reverse,Unique);

19
help / Re: DAME - a new map editor made using flixel!
« on: Wed, Mar 2, 2011 »
Well you could probably modify the export script so that it exports groups as separate levels. I did this for a project I'm working on so I could keep multi-part levels all grouped together in one .dam file, but my export script uses XML as it's output rather than the Flixel exporter.

20
games / Re: Rune Hunt [Beta]
« on: Wed, Sep 1, 2010 »
Hey Titch!

Thanks for the praise and suggestions for improvement! :)

I got the following tip from an Admin on FGL:

Quote
I do think it should sell well, but I would encourage you to speed the beginning up. It's not about showing the "best bits" in the first minute, necessarily... it's about conveying why this lighting model is going to make the game more fun. Based on the first minute of gameplay it looks like a maze game... sponsors don't historically pay a lot for maze games. And as you've seen, they make up their mind about games very quickly.

In case anyone of you who played it have a suggestion how to improve the beginning without introducing the Darkspawn (eyes-in-the-dark) earlier I'm all ears.

Well I don't know how work heavy it would be, but doing something like Aquarius 'gauntlet run' in the first few minutes would probably work. You send the player through very very difficult section of the game, but death and survival both just push you forward into the next scene. Presented as some kind of dream/nightmare.

Pages: [1] 2 3 ... 14