Final


Last scene: meet with 3 men.




1. Makes fight flash 7 times.
2. Put a text to center: "Govenor! Do you see us?"
3. Put the image:



4. And maybe text to center: "Cyberion II. Soon." :)



Enemy Dies

At library.png you find 3 small yellow cube. When an enemy dies, appear 2-4 (random from the three kind) piece of it, random place of the wear.png area. Then the gravity works, so they fell down (speed of all at first = 1, then 2, then 3...) if one of them touch the ground: 97 + random(0 to 4) (bottom coordinate of the cubes), then it simply stops. Don't touch each others, when they felt down, so it must be >= 2 pixel gap beetween them horizontally.



And of course, same time the two minus number flies up.



Fight

This fight metod comes from Samurai Jack, it is my favourite cartoon. It is a manga style cartoon made by Gendy Tartakowsky, philosophical and great.

It will be a kind of "blade" flashing it takes 3 frame.

    

1st frame: the flash first half appears. 2nd frame: full of the flash appears. 3rd frame: just second part appears. It is easy. I use the yellow lines just for the example, it does'nt appears.

It won't reserve png-s. I need the system Ellipse and Polygon drawing procedure. I draw white stuffs. Antialias need, so I use an other Ellipse/Poligon moved by 1px and in half-gray color. It requires black (#010C18) full screen. As the game, it is resoultion independent, too. I use 128x160 for the demo. Halfgray is #888888.



2nd frame

We need a base square image. It's size is larger than the full screen. If wh = max(w, h); then its's size is fw x fh, where fw = fh = 2 * wh;




cy, cx is the center, get a random position x, y outside the active screen. cr is the distance between the center and the random point, rn is a random multipler (you should play with it, if the fight seems bad). Draws the ellipses: Ellipse(x, y, rayx, rayy, color) means it's center at x, y, rayx, rayy is the two ray.

cr = sqrt(x - cx, y - cy);
rn = wh / 8;

mx = random(0, rn) - rn / 2; // move x
my = random(0, rn) - rn / 2; // move y
rx = random(0, rn) - rn / 2 + rn; // ray x modifier
ry = random(0, rn) - rn / 2 + rn; // ray y modifier
Ellipse(x + mx, y + my, cr + rx + 1, cr + ry + 1, halfgray);
Ellipse(x + mx, y + my, cr + rx, cr + ry, white);

mx = random(0, rn) - rn / 2; // move x
my = random(0, rn) - rn / 2; // move y
rx = random(0, rn) - rn / 2 - rn; // ray x modifier
ry = random(0, rn) - rn / 2 - rn; // ray y modifier
Ellipse(x + mx, y + my, cr + rx + 1, cr + ry + 1, halfgray);
Ellipse(x + mx, y + my, cr + rx, cr + ry, black);

It draws a bend, like a sword blade made by. It is frame 2, but we need to cover one half of it, to make the frame 1.



The 1st and the 3rd frame

ox = cx + (cx - x); // opposite side
oy = cy + (cy - y);

if (abs(oy - y)) < h) {
  if (ox < x) { s = x; x = ox; ox = s; s = y; y = oy; oy = s; }
  if (random(0 or 1)) {
    Polygon((0, 0), (fw, 0), (ox, oy + 1), (x, y + 1), halfgray);
    Polygon((0, 0), (fw, 0), (ox, oy), (x, y), black);
  } else {
    Polygon((0, fh), (x, y - 1), (ox, oy - 1), (fw, fh), halfgray);
    Polygon((0, fh), (x, y), (ox, oy), (fw, fh), black);
  }
} else {
  if (oy < y) { s = x; x = ox; ox = s; s = y; y = oy; oy = s; }
  if (random(0 or 1)) {
    Polygon((0, 0), (x + 1, y), (ox + 1, oy), (0, fh), halfgray);
    Polygon((0, 0), (x, y), (ox, oy), (0, fh), black);
  } else {
    Polygon((fw, 0), (x - 1, y), (ox - 1, oy), (fw, fh), halfgray);  
    Polygon((fw, 0), (x, y), (ox, oy), (fw, fh), black);  
   }
}

The "condition abs(oy - y)) < h" means x, y and ox, oy is left and right to the active screen. The  "if (ox < x)" and "if (oy < y)" swaps the two points if needs to draw the polygon in the proper order.






That's the 1st frame. And the 3rd is the same, just at the algorytm random(0 or 1) must give the opposite. That's all! Then the fight goes: randomly 3 or 4 times: frame 1, frame 2, frame 3, black screen, frame 1, frame 2, frame 3, black screen, frame 1, ...

And imagine, every time the random values change, so it seems like somebody fight with a sword!

I know it seems hard, so I write algorytmically. If you have any question, or I make errors, just write.

Extension

If "if (abs(oy - y)) < h) {" condition works, x,y is in the blue area.