Showing posts with label AS3. Show all posts
Showing posts with label AS3. Show all posts

12.16.2010

Compile ActionScript file using mxmlc

Steps in compiling ActionScript file (.as) using mxmlc of Flex SDK.

Obtaining the Compiler
- To create SWF files from ActionScript, you will need a compiler, the program that interprets ActionScript code and translates it into the machine code used in SWF files. The compiler used to compile ActionScript or MXML is mxmlc.exe. mxmlc.exe can be downloaded free, just download the latest Flex SDK, and you will obtain the MXMLC.EXE.

MXMLC.EXE - can be found in SDK_PATH/bin/mxmlc.exe.

About mxmlc.exe

mxmlc.exe is a launcher that runs the MXML and ActionScript 3 compiler that converts MXML files (.mxml) and ActionScript 3 files (.as) into published SWF files (for the purposes of this tutorial, we will be primarily concerned with ActionScript 3 files though the compiler handles both as well as some other file types used in the ultimate generation of the SWF). The real compiler is a Java jar file located in the lib directory of your Flex Builder/SDK install and not mxmlc.exe itself. Because of this, to work with the compiler you'll A) need to make sure you keep all of those files of which the compiler is dependant (i.e. dont go moving around just mxmlc.exe and expect it to work), and B) need to have the Java runtime environment installed on your system. If you've installed Flex Builder you won't have to worry about this since it will take care of this for you. If you just got the SDK, however, and haven't had Java installed on your computer, you can download and install the Java runtime environment from http://java.sun.com.

In the directory containing mxmlc.exe you may notice some other executables. compc.exe is for creating SWC files (pre-compiled component file), and fdb.exe is the command line debugger. Here we are sticking to just using mxmlc.exe which is all you need to get started using ActionScript 3.

For mxmlc command line options, just visit http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_13.html

How to compile ActionScript in mxmlc
- create a batch file. Here is a sample of batch file I used for compiling fonts.
C:\flex_sdk_4.1.0.16076\bin\mxmlc.exe -o output.swf -source-path=C:\_cafepress\devtools\manila\fonts\src\ C:\_cafepress\devtools\manila\fonts\src\font\Alepholon.as

- the ActionScript file (I used Alepholon.as here)
package font
{
import flash.display.Sprite;
import flash.text.Font;

/**
* Font library
* @author mykhel
*/
public class Alepholon extends Sprite
{

[Embed(source='../../lib/Alepholon.ttf'
,fontFamily ='Alepholon'
,fontStyle ='normal' // normal|italic
,fontWeight ='normal' // normal|bold
,unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E'
,embedAsCFF='false'
)]
public static const fontClass:Class;

public function Alepholon()
{
Font.registerFont(fontClass);
}

}

}

Note: This class is to embed font. I get this sample in one of the output file of automation tool in converting Font file (.TFF) into SWF that I have created.

- Run the batch file, and look for the output file. In my example, output file can be found in the directory of the batch file.

Download the sample files here.
Please note, I cannot include the Alepholon font, but you can try the other font. Play around with the batch file, change the path and options.

Original story here.

6.22.2010

Color Spectrum Chart AS3





Color Spectrum Chart is a AS3 tool for creating different types of color spectrum chart. It is very useful for custom color picker. This class includes ColorUtils class, another class which is useful in manipulating colors.

This is PURE CODE and PURE CALCULATION, using pixels and arrays. Absolutely no images embeded. This only requires 2-kb of filesize, and the speed is well analyzed and it is very fast.

I have no liable in other color spectrum charts or others. This class is purely coded and no tools, besides with FlashDevelop, has been used. I'm sharing this to others with no charge. Again, The images (Bitmap) that comes out after finishing this tool was not intended to copy with the others. It is only how it was output by the algo.

The AS3 file is documented well, and will easy to be use by other developer. The tutorials is in the class itself as well as in the ColorUtils class.

Source code here. (used FlashDevelop, if using Flash IDE/FLEX, just copy the src foloder and use the Main.as)
Demo here.

1.29.2010

Free 3D Carousel Effect AS3

I wrote a 3D Carousel Effect in AS3.

Features:
- The code is neat and easy to understand.
- It is open source so you can use it or abuse it.
- All images and names are in XML.
- It has ToolTip, too.
- Flexible in any environment: Flex or FlashDevelop or Flash IDE.

The XML I used is from my arcade site (MPTGAME.COM)

You can download the file here.

1.01.2010

AS2 and AS3 Tutorials to Create Flash Games

How to create Flash Games? Well, there are lots of tutorials can be found in Google. Just search and learn, it just needs dedication and patience. Flash is a very flexible application for building games that are both entertaining and educational and and also it can be developed both online and offline applications, too. However, the software itself is a quite tough to learn and extremely hard to master, as I said it just need dedication and patience and discipline. There are lots of websites providing free and paid tutorials of flash. Here we present you a bunch of free tutorials for game development in flash. We believe these are the best free tutorials available in Flash Game Development. And all these tutorials come with the source files.!

If you need tutorials or components for Flash Physics, just visit my previous article here. It is collection of AS2/AS3 Physics Engine.

1. Flash Racing Game Tutorial

Flash Racing Game

This is a “time trial” racing game tutorial. After completing it, you will be able to make your own racing game with custom tracks and cars, smooth collisions, lap records and more.

2. Balloon Shooter

Balloon Shooter

It is a shooting game where player / user have to shoot the flying balloons and gain the points. There are orange colored balloons, which gives player / user extra bonus points. Player / user get 1-minute time to play this game, within this period he / she need to shoot as many as balloons he / she can. For every missed balloon, separate score is maintained.

3. Guess Next

Guess Next

GuessNext, a simple card game with highscores.

4. Space Shooter

Space Shooter

Its a series of tutorials on how to develop Space Shooter game.

5. Platform Game Tutorial Redux: All The Basics

Platform Game Tutorial

This tutorial will show you all the basics of creating a platform game, Collisions that automatically move up slopes, Jumping, Moving, Simple Scrolling, Basic AI, and health

6. Make a dynamic hangman game with XML and ActionScript

Hang man

This tutorial is intended for intermediate or advanced users of ActionScript. Before continuing with this lesson, you should already know some fundamental ActionScript concepts, such as variables, if/else conditional logic, for loops, function basics, paths, dynamic text fields and movie clip events.

7. Snake Game Tutorial

Sanke Game

The “snake game” (it has several names) is one of the simplest game concepts ever, and just like Tetris it’s very addictive. There are a lot of variations of this game written in Flash, and this tutorial will explain one way to create it. It’s a relatively easy game to code, but many fail to make sure that when keys are pressed in rapid succession they are all registered. This is necessary if you want to have full control of the snake at all times.

8. Create a survival horror game in Flash tutorial

Horror Game

From Wikipedia: Survival horror is a video game genre in which the player has to survive against often undead or otherwise supernatural enemies, typically in claustrophobic environments and from a third-person perspective. This is the tutorial of a new and very funny game that introduce some concepts I’ve never seen before in a Flash game.We’ll learn how to create the engine for a survival horror game.

9. Creating a Flash Lite Game Tutorial (Flash game for Mobile Devices)

Develop your own Flash Mobile Game

The game we will create is a very basic arcade game, the player merely collects the objects before they reach the ground. If he fails to collect three objects then the game ends. This tutorial will teach you how to create a Flash Lite game playable on the Flash Lite Player version 1.1 – one of the earliest versions and most restricted, but the most widely spread version as well. Our basic game could be created without using the advanced features provided in later versions. Adopting Flash Lite 1.1 will guarantee that the game will be compatible with the largest possible number of Flash Lite powered devices.

10. Flash dodge ball game

Dodge Game

This tutorial teaches to create a dodge ball game in Flash. This is going to be a very long tutorial so even newbies should be able to follow it, and hopefully learn a lot, and to see how easy it is to make games in Flash. It is divided into 7 parts, from making of the character to getting points.

11. Create a flash artillery game

Artillary Game

This tutorial teaches you to create a flash artillery game. Something like Worms. Or similar.

12. Creating a Sniper Game in Flash

Snipper Game

It teaches you to create a Snipper Game in Flash. The step by step tutorial will be very helpful for you to create similar games in future..

Part 1- http://www.worldfaction.com/forums/showthread.php?t=44

Part 2- http://www.worldfaction.com/forums/showthread.php?t=48

Part 3- http://www.worldfaction.com/forums/showthread.php?t=63

13. Chicken and Eggs Game

Checken and Eggs

This tutorial going to teach you create one of the most popular game in Flash – Chicken and Eggs This tutorial only explain the logic used by the game and will not go into creating the graphics. You will need to change the used Movie Clip graphics to personalize the game to your liking. Also remind you that using the same graphics of the original game could be illegal.

14. Mini Car Race Game

Mini Car Race Game

People show you how to make your car move, or a car with boundarys – but you may wonder how to make your own mini-game.. good animaters will find the CPU part alot easier by the way.

15. Flash ball game with visual effects

Flash Ball Game

This tutorial I’ll cover two types of gameplay: one with the ball that runs on a static stage, and one with a fixed ball with a scrolling stage. We’ll see the pros and cons of both type of games.First of all, you have to take your ball to the exit of each level avoiding any kind of traps.

16. Flash Fighting Game tutorial

Fighting Game

Learn how to make a Fighting Game with this simple and good tutorial. Learn how to make HP bars, hitTest function and more

17. Simple Jigsaw Puzzle Tutorial

Jigsaw Puzzle

The aim of the project is to demonstrate the object oriented capabilities of Flash. This is a simple four piece jigsaw puzzle, programmed with ActionScript. The coding is done in such a way that new puzzles can be created using the same file, with very little effort.

18. Basic Flash Hit Game Tutorial (Video Tutorial for Beginners)

Hit Game Tutorial

This tutorial teaches how to Create a character, move it, create buttons, basic hitting, and use health bar.

19. Create a flash game like Security 2

Security Game

This is one of the interesting games in Flash which is created in logic of the game Security 2 . It’s a simple game: navigate through a level by using the arrow keys avoiding security traps and guards. This one is easy do develop but so interesting about artificial intelligence.

20. Complete Flash pool game with high scores

Pool Game

This is one of the very latest flash game developed by Alejadro Quarto, from Argentina. You can download the source file from the blog of Emanuele Feronato. Alejandro made this game in a day! The step by step tutorial is yet to be published. Still you can download the source file now.

12.29.2009

List of AS2/AS3 Physics Engine

I collected some AS3 Physics Engine projects listed below. If you know others not in following list reply it please.

1. Box2DFlashAS3

box2d

Box2DFlashAS3 is an open source port of Erin Catto’s powerful c++ physics library Box2D.

2. WOW-Engine

a free AS3 open source physics engine written by Seraf ( Jérôme Birembaut ) capable to handle positions in a 3D environment.use Sandy library for all the 3D mathematical computations (matrix, 3D vector, plane). The inner architecture of the engine is also inspired by Sandy’s one.

It is built with many open source kits that are emerging. It can use any of the 3 major flash 3d engines (pv3d, sandy, away3d)

3. foam-as3

a two-dimensional rigid body physics engine written in ActionScript 3.0.

It is meant as an architectural and mathematical reference for developers interested in physics simulation in the area of game development or otherwise. It trades efficiency for modularity and extensibility.

Here is the author’s blog.

4. APE

APE

APE (Actionscript Physics Engine) is a free AS3 open source 2D physics engine for use in Flash and Flex, released under the MIT License.

You can see two interest demo at here and here.

5. Motor Physics

motor

Motor Physics is an open source 2D physics engine under the zlib/libpng license.

6. Revive

Revive is an open source 2D physics engine.You can download the source code from here.

7. Flade (Flash Dynamics Engine)

FLADE

Flade (Flash Dynamics Engine) is an open source actionscript 2.0 library for simulating 2D physics using Verlet integration. It currently features rectangular, circular, & wheel primitives, spring & angular constraints, and surfaces composed of line segments, circles, & rectangles. It’s designed primarily for games with a goal of speed and ease of use, and is MTASC -strict compatible.

8. Fisix Engine

fisixengine

an Actionscript 3.0 physics engine built for game developers.

The fisix engine is a verlet based physics engine for flash written in Actionscript 3.0. This engine is aimed towards use in games and other relatively cpu intensive real-time applications.

9. glaze (browse source here)

a game and physics engine for Flash,core parts of the physics solver and collision system are based on the C physics engine Chipmunk.