Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkCollisions should return strongly typed Object #7

Open
GoogleCodeExporter opened this issue Mar 22, 2016 · 3 comments
Open

checkCollisions should return strongly typed Object #7

GoogleCodeExporter opened this issue Mar 22, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Couple of suggestions for the array returned from checkCollisions.

Right now, when you call checkCollisions() you get an Array of objects returned 
to you for each 
collision.

These objects should be Strongly typed. This will be faster for the player, and 
will make it easier 
to work with.

Maybe something like:

public class Collision
{
public var targetObject:DisplayObject; // the target
public var collisionObject; //the item the target is colliding with
public var overlapping:Array; (over Vector.<Point>;
}






Original issue reported on code.google.com by mikechambers on 21 Jun 2009 at 10:56

@GoogleCodeExporter
Copy link
Author

Agreed.  This is a change I would have liked rolling into the last update but 
was 
overlooked.  Will be done for next release.

You keep this up, Mike, and I'm going to have to start subversioning.  ;P

Original comment by lessthan...@gmail.com on 22 Jun 2009 at 7:39

  • Added labels: Priority-High, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

There are lots of more places in your code where strong typing is pleased. Start
subversioning :-P.

Original comment by e.verd...@gmail.com on 24 Jun 2009 at 5:28

@GoogleCodeExporter
Copy link
Author

I just made some changes in findCollisions() to support strongly-typed 
parameters.
I find this helpful because I can keep strict mode and all warnings.

protected function findCollisions(item1:DisplayObject, item2:DisplayObject):void
{
    var item1_isText:Boolean = false, item2_isText:Boolean = false;
    var item1xDiff:Number, item1yDiff:Number;
    if (item1 is TextField)         
    {
        item1_isText = ( TextField(item1).antiAliasType == "advanced") ? true : false;
        TextField(item1).antiAliasType = ( TextField(item1).antiAliasType == "advanced") ? "normal" :  TextField(item1).antiAliasType;
    }
    if(item2 is TextField)
    {
        item2_isText = ( TextField(item2).antiAliasType == "advanced") ? true : false;
        TextField(item2).antiAliasType = (  TextField(item2).antiAliasType == "advanced") ? "normal" : TextField(item2).antiAliasType;
    }

Original comment by jb...@gwgamedev.com on 18 Dec 2010 at 6:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant