... Just see what youve done
The last game of the GOL collection and my 3rd (while Squize is still missing one :) ).
Anyway, this time your task is the joy of gardenening. With movement based on Asteroids you just have to chop down as much grass as possible in the (short) given time. Earn some extra by making sure those nasty little buggers stay off the lawn.
As Squize already mentioned this game has the weakest name ("The Day of the Triffids") but may be the one with the most action.
Nothing much more to say, we just have to wait for them to go online now ...
nGFX
ps: and now ... if can tell me the artists of the three songs I've quoted ... you can win ... well I'll find something.
... Let my spirit carry me.
So this is the third game (yes, I know, there are currently only two (including this one), but it seems that Squize didn't post yesterday ... shish!)
You surely remember the time when you just walked up the diving platform, stood on the highest one and did a somersault, backwards ...
... and you surely noticed that each year you thought about "what can go wrong" a bit more.
Well, after a certain point you forget about the risks and you go hang gliding, High Jinx in our case or short HJ.


Distance is the key to get your blood flowing again, and of course you have to do some resource management to get as far as possible.
After all I enoyed doing HJ, hope you enjoy plaing it.
2 games left ...
nGFX
... and it want it painted black.
Nah. painting is pure joy. Keeping an eye on your grandchild, too. Don't try it at the same time, though.
Finally after all those weeks here are some screenies from "Holding the Baby" or short ... HTB, one of the five games from the "Game of Life" collection we did (and one of the games I had the joy of doing).
Did I mention that you have to get it done in time?
Well you'll see yourself ... 4 more to go.
nGFX
Long time no post, so I thought it might be the time to do so again ...
While still working on the last GOL game ("The Day of the Triffids"), my mind starts wondering off to the next big project, the "logimotion" game.
I do dimmly recall that when doing the Wintertales/Deserrunner game I said something about explanation, but I guess it somehow slipped through just waiting there to be recalled now ...
So here we go:
Time based movement and tracks/tiles ...
While doing the engine I came to the point where I had to move the sprite over the player created tracks, two ways came to mind:
a) write some fancy stuff for each tile, using the sprite and offset it's coords according to the need of the tile.
b) write some fancy stuff that works whth each tile, using some other approach.
I decided to try the latter one.
What bothered me with the first method was that I had to map out coordinates or tween the sprite along the tracks which somehow wasn't what I wanted.
The second method wasn't that clear. I needed to find a way to move the sprite from the starting point of the tile/track to it's end ... after a few pointless tries I thought that I could just do it time based instead of position based.
This proved to be a very easy and re-useable way.

screenie of the car in motion, showing the track, too.
As the car isn't shown top/dow, there needed to be some sort of animation and we wanted to be able to move with different speeds, too.
My first task was to invent some sort of naming convention which helps me to sort the different tiles and tell the code *what* this tile does without adding to much fuzz to the map.
So I decided to use a for digit code like 0011 for a corner from west to south, giving each direction either 1 for "exit" and 0 for "no" exit.
Then I decided to use "easings" to move from the starting point of the track to end point of the track. Moving a stright line (0101, or from west to east) would just ease the x value linear in say 16 frames (and because I had 16 animation frames ... you guess right).
This is what I stored for the tile:
this._tile_array[22] = {sx: 1, sy: 1, t: TileEngineClass.TILE_TRACK, f: "t_0101", d: "0101"};
sx/sy: size
t: tile type
f: frame in the tile mc
d: direction information
And this is what the player sprite "knows":
this._track_array["0101"] = new Array();
this._track_array["0101"][1] = {sx: _x0, sy: _y1, ex: _x2, ey: _y1, fx: EaseUtil.easeLinear, fy: EaseUtil.easeLinear, nd: 1};
this._track_array["0101"][3] = {sx: _x2, sy: _y1, ex: _x0, ey: _y1, fx: EaseUtil.easeLinear, fy: EaseUtil.easeLinear, nd: 3};
sx/sy/ex/ey: start coords/end coords for the easing
fx/fy: easing method for x/y
nd: the new direction after reaching the end point, used for corners mainly.
The sprite knows which direction (0-3, according to the 4 digits of the name) it's moving, the animation it should use ("0101" + frame for the current time) and it's time.
If the sprite reaches the endpoint of the ease, I can look up the next tile in the map array (because if the direction of the next tile is 1, I take the next tile east of the current tile).
If the next tile is empty, well the player creashes.
Easy, isn't it?
Here's the data for a corner:
this._track_array["1100"] = new Array();
this._track_array["1100"][2] = {sx: _x1, sy: _y0, ex: _x2, ey: _y1, fx: EaseUtil.easeInSin, fy: EaseUtil.easeOutSin, nd: 1};
this._track_array["1100"][3] = {sx: _x2, sy: _y1, ex: _x1, ey: _y0, fx: EaseUtil.easeOutSin, fy: EaseUtil.easeInSin, nd: 0};
In order make it faster I just reduce the time needed to get from start to end, though it's a good idea to use something that can be devided by 2, so the animation isn't messed up
You can see it in action: here (German version, though)
Back to the Triffids ...
nGFX
"Some people are heroes. And some people jot down notes."
-- (Terry Pratchett, The Truth (us, de
))
It was a puzzle why things were always dragged kicking and screaming. No one ever seemed to want to, for example, lead them gently by the hand.
- -- (Terry Pratchett, The Truth [deutsch] [English, US]

)
Same with some games.
I'm usually pretty solid when it comes to the code layout for a game, depending on the requirements I normally use the "best" way. Normaly. This time the thing got a bit ugly, the basic idea was quite simple, the requirements quite low all in all a short game.
The engine was done in two days, about 400 lines of code and because it all was so easy, I just dropped into an extended MovieClip class. No need for a big layout with a set of classes that divide UI, logic and so on. Normaly.
So now there is a quite cluttered class, lots of ugly code and no real time to make it readable again. Shish!
Anyway, mending the last pieces of it together now (and trying to clean up the 950 lines of code).
nGFX
As promised way to long ago (here), I finally manged to get the brush example done.
Not the best way, not the best code, but an example nonetheless.
(just press the left mousebutton and move the mouse ...)
And the zipped fla (F8): drawexample.zip (6,11 KB)
And for those hwo don't want to d/load the fla ... just the code. You just need this two images set for export in the first frame:
(Brush, with alpha)
(color / pattern)
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;
var bmpColor:BitmapData = BitmapData.loadBitmap("color_00.png"); // the color to paint with
var bmpWall:BitmapData = new BitmapData(480, 200, false, 0xc0c0c0); // a bmp to paint in
var bMouseDown:Boolean = false;
var iPaint:Number = 0; // "color on brush"
this.onEnterFrame = function ():Void {
var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png"); // the "brush"
var iPosX:Number = this._xmouse - (bmpAlpha.width * 0.5);
var iPosY:Number = this._ymouse - (bmpAlpha.height * 0.5);
if (bMouseDown) {
// modify alpha ...
bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, iPaint));
bmpWall.copyPixels(bmpColor, bmpAlpha.rectangle, new Point(iPosX, iPosY), bmpAlpha, new Point(0,0), true);
this.attachBitmap(bmpWall, 0); // show ... (not the best way, imho ...)
// Disolve paint ...
iPaint -= 5;
if (iPaint <= -250) {
iPaint = 0; // just resti t
}
}
}
this.onMouseDown = function ():Void {
bMouseDown = true;
}
this.onMouseUp = function ():Void {
bMouseDown = false;
}
nGFX
Ha! The title says it all, yet again a text only post ...
While working on the current game (the same project Squize is working on, see his last post), I needed way to be able to paint an area in a real life fashion (that is, the paint on the brush runs out just a few centimeters before the end of the wall).
I must admit, that I didn't have much play with f8's BitmapData before, I just don't needed it. Until now.
I just hate it to get into something "new" in the middle of a project, but unlike some of Flash's other new things BitmapData is fairly easy to get into. Except the part where you start to mess with matrixes. I had some great examples which showed a lot of the stuff I thought I need, but I just wasn't in the mood to dig into using matrixes for creating the desired effect.
But there is hope ...
Using 3 BitmapData objects, 2 PNGs and copyPixels with alpha ...
Part of the code:
var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png");
var bmpBrush:BitmapData = BitmapData.loadBitmap("paintpattern.png");
// mod alpha
// iPaintAlpha is a value from 0 (paint it) to -255 (paint nothing)
bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, this._iPaintAlpha));
this._bmpPaintArea.copyPixels(bmpBrush, bmpAlpha.rectangle,
new Point(this._xmouse, this._ymouse), bmpAlpha, new Point(0,0), true);
this._iPaintAlpha--;
Et viola ...
Instead of using some matrix stuff, I just "alpha" the alpha chanel mask with a ColorTransform and use this to copy the "paintpattern" into the painting area ...
I'll upload an example file once I've reached my current milestone ...
nGFX