Home » Archive

Articles in the Game Category

AS3, Game, Math, flash »

[2 Jun 2009 | No Comment | ]

That’s it, the following code finds for you the shortest rotation angle from a given angle to another:

var diffAngle:Number = Math.atan2(Math.sin(angleTo - currentAngle), Math.cos(angleTo - currentAngle));

The code was given on this forum. You’ll also find a way to do it with vectors.

AS3, Commercial Projects, Featured, Game, Headline, flash »

[29 May 2009 | 7 Comments | ]

Here it is, the new and unique Prototype Experience using Facebook Connect for the new blockbuster game by Activision: Prototype.
I don’t think it has been done before and so I invite you to go and visit the site before you read this post as I will explain a bit more about the development process (as far as I’m allowed to) behind this promotional website.
First of all, I’ll briefly describe the website, what it contains and eventually what issues we have encountered while developing it. Then I’ll write about the most …

AS3, Game »

[25 Apr 2009 | 6 Comments | ]

hitTestPoint is a very usefull function when you want to test if a point (x, y) hits a shape, even an irregular one.
But there are a few but important things that you got to remember to get it to work properly:

the dispay object you’re working on must be added to the display list.
use TRUE for the last parameter of the function if you want your point to be tested against the actual shape and FALSE if you just need it to be checked against its bounding box.
and last but not …

AS3, Game, General game programming, Math, Useful links »

[4 Mar 2009 | 2 Comments | ]

There are many ways to calculate the surface of a polygon. It all depends on what kind of data you have to deal with. If you have only vertices (points) or if you have the segments associated to them as well.
The most evident solution would be to divide the polygon in triangles and calculate the surface of them. But this can quickly become complicated as you will have to test every segment of every triangle and check if they are intersecting with a current polygon’s segment or if it goes …

AS3, Game »

[5 Feb 2009 | 4 Comments | ]

This is something I have been looking for for a couple of hours. When I finally found out how to do it the way I needed to do it, I stepped on a blog explaining that a function actually exists for that specific need (see http://jobemakar.blogspot.com/2007/06/rotating-around-point.html)
This function is part of the fl package (comes with Flash but not the Flex SDK) and is called : rotateAroundInternalPoint.
The function is actually really simple when you understand how the Matrix.transformPoint() method actually works.
In a few lines, I’ll try to explain how the rotateAroundInternalPoint …

AS3, Game, General game programming, Network programming, Strange/Bugs, managers »

[29 Jan 2009 | 12 Comments | ]

Basic Events manager classes. Remove all events, group events, suspend and resume events…
Features

Keep track of all events added and removed with this manager.
Add listener.
Remove listener.
Add a listener to one or more groups.
Suspsend a listener and/or a group of listeners without removing them.
Resume a listener and/or a group of listeners.
Remove all listeners from a group.
Remove all listeners.

For what purpose ?
Well, frankly, those events are sometimes a pain in the arse to manage.
Let’s say we have a bunch of buttons we just want to disable for some period of time and then …

AS3, Game, General game programming »

[4 Jan 2009 | 5 Comments | ]

Let’s have a look at arrays vs. linked lists, and for what use.
Here, the assumption is that we need to access a property and/or call a function from a lot of objects in a list at the highest speed possible. Let’s say we are making a game and we want to go through all of our animated sprite objects.
Basically, we have two options:

Arrays
Linked lists

Arrays
Commonly used, arrays are easy to manipulate. You just need to iterate through it and access each object via its index in the list. For a loop …

AS3, Game »

[20 Nov 2008 | 3 Comments | ]

The Mind Reader v0.4 source code (AS3)

AS3, Game, Useful links »

[18 Aug 2008 | No Comment | ]

Export Blender objects to PaperVision3D, Away3D and Sandy:
http://www.rozengain.com/blog/2008/01/02/export-your-blender-objects-straight-to-away3d-papervision3d-and-sandy/