Main code:
initialization functionRead more: MochiLand: Tutorial: Custom Leaderboards With Mochi API (AS3)
Best articles on Flash Development and Software Design
ScoreDisplay
: [...]\lib\site-packages
directory and, in theory, adjust your pythonPath
accordingly. However in practice this doesn’t always happen. Should you begin receiving any Import Error
messages after installation, you’ll probably need to manually adjust your Environment Variables. More information on adjusting Path Variables may be found here. New > Text Document
[...] This entry is part 3 of 3 in the series Build a Stage3D Shoot-'Em-Up
In this tutorial series (part free, part Premium) we’re creating a high-performance 2D shoot-em-up using the new hardware-accelerated Stage3D
rendering engine. In this part, we’re adding eye candy with particle systems, a parallax effect, framerate-independent game loop timers, and collision detection.
-default-frame-rate 60
” in your compiler options to ensure you get the best performance. GameParticles.as
and implement the basic particle and explosion helper functions [...]Read more: Build a Stage3D Shoot-’Em-Up: Explosions, Parallax, and Collisions
The const and final keywords only apply at compile time. Despite having written about const and final before, readers frequently ask me about these two keywords. Today’s article will answer the question and definitively show that these keywords only apply at compile time: not runtime. Let’s start with const. Consider this simple class: class MathConstants [...]
Read more: Compile Time OnlyTextField
one by one using the Timer
class. static
, which means it doesn’t need to be instantiated using the new
keyword. To access a static class member, use the name of the class instead of the name of an instance. Create a new ActionScript file and write the following code: package { import flash.text.TextField; import flash.utils.Timer; import flash.events.TimerEvent; public final class Typewriter { /* Declare the variables and methods as static */ private static var chars:Array; //the characters in the string private static var cLen:int; //length of the string private static var tf:TextField; //textfield to which the string will be written private static var timer:Timer; //pauses between writing each character private static var i:int = 0; //variable used to count the written characters public static function write(txt:String, txtField:TextField, time:Number):void { chars = txt.split(""); //split the string into an array of characters cLen = chars.length + 2; //length of the string tf = txtField; //assign tf to the text field passed to the function timer = new Timer(time); //set time according to parameter timer.addEventListener(TimerEvent.TIMER, writeChar); timer.start(); //start writing function } private static function writeChar(e:TimerEvent):void { tf.appendText(chars[i]); //writes a char every time the function is called i++; //counts the written chars if(tf.length == cLen) //check whether string is complete { timer.stop(); timer.removeEventListener(TimerEvent.TIMER, writeChar); //clear timer timer = null; } } } }
Typewriter.as
class to your project folder and use the following code: That’s it, test your movie and you’ll see your TextField using the Typewriter effect.import Typewriter; Typewriter.write('Text to Write', targetTextfield, 50);
This entry is part 2 of 2 in the series Build a Stage3D Shoot-'Em-Up
In this tutorial series (part free, part Premium) we’re creating a high-performance 2D shoot-em-up using the new hardware-accelerated Stage3D
rendering engine. In this part, we’ll extend our rendering demo by adding an animated title screen and menu, music and sound effects, and a keyboard-controlled ship that can fire bullets.
Today, Jackson Dunstan posted about how to use a profiler to get better performance in flash.
For this post he decided to show how to use TheMiner… awesome!
In this post he’s profiling two sorting method: native vector. sort, and Skyboy’s fastSort code.
At first I was impressed by the result of Skyboy. Then I realized two things.
First, The flash native sort REALY don’t like Number.infinity, negative infinity.
So when sorting and vector. with these values inside, it’s getting a LOT slower.
Where a standard vector could take 100ms to sort, one with infinity values in it can take up to 2000ms!!
The other thing is fastSort is using void (*) pointer everywhere.
So if we go back a few day to my previous (epic) article , we know that this is a really bad thing when casting from void to Number.
It’s allocating a LOT of memory. (5Mo/Sort on 50K elements)
So I decided to add a few hundreds lines to this class with already a lot of it (fastSort)
I added a specific sorting method for int, uint and Number to manage only typed values.
The result is quite amazing!
Native Vector Sort : 100 ms + 400Ko allocation
UnOptimized fastSort : 400 ms + 5Mo allocation
New Optimized fastSort : 20ms + zero allocation
Finaly, just before giving you the code, I want to invite you on a new little forum that focus on Performances, optimization, debugging and multiple other flash hardcore subjects.
Many of the most hardcore dev and blogger I know are already in or are going to join soon, so please be part of this and enjoy posting refreshing and brain teasing content!
The Hardcore flash forum
And now.. the way too many lines of code part: [...]
In this tutorial series (part free, part Premium) we’ll create a high-performance 2D shoot-em-up using the new hardware-accelerated Stage3D
rendering engine. We will be taking advantage of several hardcore optimization techniques to achieve great 2D sprite rendering performance. In this part, we’ll build a high-performance demo that draws hundreds of moving sprites on-screen at once.
That’s exactly what your just read: the Unity3D Mobile Basic (Android and iOS), which costs $400 each, is completely FREE until April 8th. It is not a trial! Head to the Unity3D web store and download your copy.
The Unity3D Mobile Basic license allows you to develop games targeting the Android and the iOS platforms. Even though this is not a Pro license (which has lots of heavy weaponry), you still can use cutting edge technologies to create amazing games. Check this page to compare the different licenses.
Thanks Unity Technologies for that!
Read more: FREE Unity3D Mobile Basic (Android and iOS)We are very excited to share with you a brand new website we have been working on : gaming.adobe.com
We wanted to provide a place to discover what Flash enables for game development, showcase content but also a place to help developers get started with the technology.
And finally, a place to show the world what Flash can do. We hope you guys will like it.
Read more: Introducing the new Adobe Gaming websiteIn this tutorial I would like to show you how easy it is to create a classic “Snake” game in Flash. I will try to explain everything easily, step by step, so that you can develop the game further to your needs! The Game will be developed in AS3 and I will use the FlashDevelop IDE.
The game won’t be complex. Whenever we hit a wall, it will restart the game. After eating an apple the snake will grow, and a ‘new’ Apple will appear. (Actually, it will be the same apple, but I’ll explain this later.)
One of the most important aspects of the game is the code’s reaction to KEY_DOWN events. The snake will only then change its direction after a tick has passed, not immediately after a keypress. This means that, if the snake is going right, and you press down and left very fast, the snake will go down, not down AND left. Without this ‘feature’ the snake would allow us to go left while we are going right, which would mean it hit itself.
Let’s take a look at the final result we will be working towards:
In FlashDevelop, create a new Project, and inside the ‘src’ folder create a ‘com’ folder. In the ‘com’ folder create a new class, and call it ‘Element.as’.
Set the dimensions of the project to 600x600px.
The snake is make up of blue squares, which I call elements. We will create an Element Class, which draws the element. The red apple is going to be an element too, so we will extend the code with a few more lines.
Therefore we won’t create a new class for the apple. (But if you really want to, you can.)
The Element class creates a square. It doesn’t draw it on the stage, it just creates it. The registration point of the element – the position referred to by its x- and y-coordinates – is in the top-left.
After opening the Element.as you will see something like this:
package com { /** * ... * @author Fuszenecker Zsombor */ public class Element { public function Element() { } } }
First we need this to extend the Shape class, so we can use the graphics
object to draw the square. After this, create two variables: one for the direction (if it’s part of the snake), and one for the score value (if it’s an apple), and then change the parameters of the constructor function: [...]