Flash game programming in haXe

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Flash game programming in haXe

Koree Jones
If I wanted to make a Flash game in haXe, what method would I use to animate sprites on the screen? I've seen Sprite and Movieclip classes in Flash, but am unsure what the difference is between them and which would be appropriate for the entire game screen and which would be appropriate for individual game sprites, as well as the actual method I would use to animate the sprites. Would I have to write my own animation process or make a series of images into a movie clip to be played back as needed?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Flash game programming in haXe

jlm@justinfront.net
Sprites are a lighter version of a MovieClip.  MovieClips  have a timeline so if loaded a MovieClip created in flash, that has a timeline with 18 frames each with a png rendered from a 3D model with a 20 degree difference, then you could gotoAndStop the correct angled frame for your character, often in flash you can create a complex mixture of timeline tweened layers and animated layers which would be less intuitive to code, for instance a man walking smoothly.  MovieClips are dynamic in flash so you add objects like say speed at runtime, Sprites are not Dynamic but normally you extends the class to your own custom class.  Both Sprites and Movieclip's have an onEnterFrame an event that happens every time frame, also you can use setInterval or Timer dependnig on flash player to get a periodic event interval.  Often for keyboard control movements you can tween movements of a Sprite across the screen using an equation using a class such as TweenerHX. You can put movieclips in sprites and vicerverser,  

If you are not using flash then the simplest approach might be to create a sprite for each image and then add all the sprite to a holder sprite, you can then hide all but one of the image sprites, to animate ( not tween ) you could then switch the visible property of the sprites to show the images in the desired sequence.


Justin
 
On 20 Oct 2008, at 10:58, Koree Jones wrote:

If I wanted to make a Flash game in haXe, what method would I use to animate sprites on the screen? I've seen Sprite and Movieclip classes in Flash, but am unsure what the difference is between them and which would be appropriate for the entire game screen and which would be appropriate for individual game sprites, as well as the actual method I would use to animate the sprites. Would I have to write my own animation process or make a series of images into a movie clip to be played back as needed?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-- 
haXe - an open source web programming language


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Flash game programming in haXe

James W. Hofmann
My own comments:

The two things most unique to Flash are the display list  
hierarchy(which is pretty well documented) and the elastic racetrack:

http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-flash-9-and-avm2/

If you get those two concepts down, the rest is mostly details.

The "best" method really depends on what your goals are. Most methods  
will render about as fast as each other if you use the cacheAsBitmap  
property effectively or draw() effects and sequences to a bitmap. The  
area where you can't just cache bitmaps and speed becomes a major  
concern is in "unlimited" real-time transformations: procedurally  
generated vectors, arbitrary scaling, rotation and perspective,  
filters, etc.

Instead of doing "one bitmap per frame" for a bitmap spritesheet I  
suggest using scrollRect on a single bitmap containing the entire  
sequence. This is typically easier to produce art and organize a  
pipeline for, although I don't know of any speed difference.

If you want a more typical raster-graphics approach to constructing  
the scene, you can put a single bitmap on the displaylist and use  
copyPixels() to blit to it each frame.

Quoting "Justin Lawerance Mills" <[hidden email]>:

> Sprites are a lighter version of a MovieClip.  MovieClips  have a  
> timeline so if loaded a MovieClip created in flash, that has a  
> timeline with 18 frames each with a png rendered from a 3D model  
> with  a 20 degree difference, then you could gotoAndStop the correct  
> angled  frame for your character, often in flash you can create a  
> complex  mixture of timeline tweened layers and animated layers  
> which would be  less intuitive to code, for instance a man walking  
> smoothly.   MovieClips are dynamic in flash so you add objects like  
> say speed at  runtime, Sprites are not Dynamic but normally you  
> extends the class  to your own custom class.  Both Sprites and  
> Movieclip's have an  onEnterFrame an event that happens every time  
> frame, also you can use  setInterval or Timer dependnig on flash  
> player to get a periodic  event interval.  Often for keyboard  
> control movements you can tween  movements of a Sprite across the  
> screen using an equation using a  class such as TweenerHX. You can  
> put movieclips in sprites and  vicerverser,
>
> If you are not using flash then the simplest approach might be to  
> create a sprite for each image and then add all the sprite to a  
> holder sprite, you can then hide all but one of the image sprites,  
> to  animate ( not tween ) you could then switch the visible property  
> of  the sprites to show the images in the desired sequence.
>
>
> Justin
>
> On 20 Oct 2008, at 10:58, Koree Jones wrote:
>
>> If I wanted to make a Flash game in haXe, what method would I use  
>> to animate sprites on the screen? I've seen Sprite and Movieclip  
>> classes in Flash, but am unsure what the difference is between them  
>>  and which would be appropriate for the entire game screen and  
>> which  would be appropriate for individual game sprites, as well as  
>> the  actual method I would use to animate the sprites. Would I have  
>> to  write my own animation process or make a series of images into  
>> a  movie clip to be played back as needed?
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Flash game programming in haXe

Michael Norton
In reply to this post by Koree Jones
Te premise of simple sprite animation is here. Work has kept me from updating the lessons.
But worth a look.


Mike

On Oct 20, 2008, at 2:58 AM, Koree Jones wrote:

If I wanted to make a Flash game in haXe, what method would I use to animate sprites on the screen? I've seen Sprite and Movieclip classes in Flash, but am unsure what the difference is between them and which would be appropriate for the entire game screen and which would be appropriate for individual game sprites, as well as the actual method I would use to animate the sprites. Would I have to write my own animation process or make a series of images into a movie clip to be played back as needed?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-- 
haXe - an open source web programming language

Michael Norton
mnorton wecare net
Computer Graphics Tutorials 






--
haXe - an open source web programming language
http://haxe.org