FrozenHaddock Flash Games, Tutorials and Resources

25Mar/090

AS3: Avoiding Game Tutorial, pt.11

Here we go, another interesting instalment in MichaelJWilliams' AS3 Avoiding game tutorial, part 11, covers saving and loading shared objects in AS3. Handy for keeping highscores, level progress and stats. Make sure you check it out!

28Nov/085

Prox: My Avoiding Game [Released!]

http://www.fettspielen.de/en/game/skills/prox

Schiiing!

Well, It'll be a month or so until you see it in all it's shiny glory because the way Fettspleilen embed strips my bitmap data effects, but here it is to play, I'll make sure to post when it's up here on FrozenHaddock.

Have Fun!

6Nov/085

An RTS

I've been working on an RTS for a few days. It's a "Warlord: call to arms" clone.

Here it's:  - Play -

This is a direct link: The source code.

For more explanation: Forum

Still to be added:

  1. A shop
  2. A world map
  3. a goal
  4. more units
  5. better AI
  6. music

You can move  the blue arrow up and down with the arrow keys. Build a unit at that point with spacebar and switch between different kinds of units with left and right. Get your units to the rigth side of the game and receive a bonus of 100 wich makes you able to build two new units.

This is the first version on this blog so I hope you enjoy and please don't forget to leave a comment with anything you wish to be added.

Tagged as: , 5 Comments
13Oct/083

AS3: Avoiding Game Part 4

Blimey, MichaelJWilliam's is writing these quickly, Part 4, the latest in his AS2 to AS3 translation of the avoiding game tutorial series here at FrozenHaddock is now out, and ready to be followed. Go check it out!

I'm going to have to write the AS2 ones a little faster aren't I?

10Oct/080

AS3: Avoiding game part 3

That's right, part three of MichaelJWilliams's AS3 translation of the avoiding game tutorial series has been released (I have to say, I like your style Michael, Once an upgrade can be found I'll be learning along with them) and you should go and check it out!

9Oct/0812

Avoiding game pt 5b

The avoiding game tutorial series:
Part 1 Part 2 Part 3 Part 4 Part 5 Part 5b

Ok, ok, so I've gotten a telling off for how long the code in part 5 was... so here it is with fixes from Brart and MichaelJWilliams!

The frame code (With fixes from Brart):

  1. stop();
  2. clock = 0;
  3. lives = 3;
  4. score = 0;
  5. enemies = 4;
  6. enemiesonstage = 0;
  7. timer = function () {
  8. clock += 1;
  9. };
  10. enemytimer = function () {
  11. enemies += 1;
  12. };
  13. onEnterFrame = function () {
  14. if (enemiesonstage<enemies) {
  15. var enemy:MovieClip = attachMovie("enemy", "enemy"+enemiesonstage, _root.getNextHighestDepth());
  16. enemiesonstage += 1;
  17. enemy.dir = random(4);
  18. //This line sets the sizes randomly to begin with
  19. enemy._xscale = enemy._yscale=random(100)+50;
  20. if (enemy.dir == 1) {
  21. enemy._x = random(300);
  22. enemy._y = random(-50);
  23. enemy.yspeed = random(7)+1;
  24. enemy.xspeed = 0;
  25. } else if (enemy.dir == 2) {
  26. enemy._x = random(300);
  27. enemy._y = random(50)+300;
  28. enemy.yspeed = random(-7)-1;
  29. enemy.xspeed = 0;
  30. } else if (enemy.dir == 3) {
  31. enemy._x = random(-50);
  32. enemy._y = random(300);
  33. enemy.yspeed = 0;
  34. enemy.xspeed = random(7)+1;
  35. } else if (enemy.dir == 0) {
  36. enemy._x = random(50)+300;
  37. enemy._y = random(300);
  38. enemy.yspeed = 0;
  39. enemy.xspeed = random(-7)-1;
  40. }
  41. enemy.onEnterFrame = function() {
  42. this._y += this.yspeed;
  43. this._x += this.xspeed;
  44. if (this.hit.hitTest(_root.player)) {
  45. if (_root.lives>=1) {
  46. this.dir = random(4);
  47. //This line re-randomises the scale of the enmy when it hits the player
  48. this._xscale = this._yscale=random(100)+50;
  49. if (this.dir == 1) {
  50. this._x = random(300);
  51. this._y = random(-50);
  52. this.yspeed = random(7)+1;
  53. this.xspeed = 0;
  54. } else if (this.dir == 2) {
  55. this._x = random(300);
  56. this._y = random(50)+300;
  57. this.yspeed = random(-7)-1;
  58. this.xspeed = 0;
  59. } else if (this.dir == 3) {
  60. this._x = random(-50);
  61. this._y = random(300);
  62. this.yspeed = 0;
  63. this.xspeed = random(7)+1;
  64. } else if (this.dir == 0) {
  65. this._x = random(50)+300;
  66. this._y = random(300);
  67. this.yspeed = 0;
  68. this.xspeed = random(-7)-1;
  69. }
  70. _root.lives -= 1;
  71. }
  72. }
  73. if (_root.lives<=0) {
  74. _root.gotoAndStop("gameover");
  75. this.removeMovieClip();
  76. }
  77. //Brart Fixes
  78. if (this._y>=310 &amp;&amp; this.dir == 1 or this._y<=-20 &amp;&amp; this.dir == 2 or this._x>=320 &amp;&amp; this.dir == 3 or this._x<=-20 &amp;&amp; this.dir == 0) {
  79. this.dir = random(4);
  80. //This line re-randomises the scale when the enemy leaves the stage
  81. this._xscale = this._yscale=random(100)+50;
  82. if (this.dir == 1) {
  83. this._x = random(300);
  84. this._y = random(-50);
  85. this.yspeed = random(7)+1;
  86. this.xspeed = 0;
  87. } else if (this.dir == 2) {
  88. this._x = random(300);
  89. this._y = random(50)+300;
  90. this.yspeed = random(-7)-1;
  91. this.xspeed = 0;
  92. } else if (this.dir == 3) {
  93. this._x = random(-50);
  94. this._y = random(300);
  95. this.yspeed = 0;
  96. this.xspeed = random(7)+1;
  97. } else if (this.dir == 0) {
  98. this._x = random(50)+300;
  99. this._y = random(300);
  100. this.yspeed = 0;
  101. this.xspeed = random(-7)-1;
  102. }
  103. }
  104. //End Brart Fixes
  105. };
  106. }
  107. };

And the code on the player (With fixes by MichaelJWilliams):

  1. onClipEvent (load) {
  2. _root.timeclock = setInterval(_root.timer, 1000);
  3. _root.enemyclock = setInterval(_root.enemytimer, 5000);
  4. //Fix start
  5. if (_root.character>=1) {
  6. this.gotoAndStop(_root.character);
  7. }
  8. //Fix end
  9. }
  10. onClipEvent (enterFrame) {
  11. Mouse.hide();
  12. this._x = _root._xmouse;
  13. this._y = _root._ymouse;
  14. if (this._x>=300) {
  15. this._x = 300;
  16. } else if (this._x<=0) {
  17. this._x = 0;
  18. }
  19. if (this._y>=300) {
  20. this._y = 300;
  21. } else if (this._y<=0) {
  22. this._y = 0;
  23. }
  24. }

Now, I'm not the most efficiancy based person out there, infact I'm probably one of the least, so if you think you could write it better, comment here or post at the forum to shout at my laziness! If enough of you do it I might buck my ideas up, honest!

23Sep/084

RPG anyone?

I'm back! Although I doubt anyone actually knows me because of by incredibly huge period of inactivity, except from Tom. But I am back, don't know for how long, but yeah.

Anyway,

YES - Bring back the RPG!!! I've found the main file and am thinking of getting it running, yet again. However the things which lead to it stopping the last time were lazy artists (James probably won't see this so yes lazy, not busy). So anyone interseted in helping with artwork please contact me in someway, I will be putting up the current beta version at some point over the next few days, as and when I get the chance to block off any bugs etc I'm aware of and those which I am currently fixing.

Also, even if aren't a flash artist, would you like to see the return of the RPG?

Until I get it up, here's a link to an incredibly old version, but the best preview I can give you so far.

22Sep/084

AS3: Avoiding game part 2

Check out part two of Michael J Williams's translation of the Avoding game tutorial, in which he teaches you (and me) how to add multiple enemies, here!

17Sep/082

AS3: How to create a simple Avoiding game Part 1

Well, in the last post I did tell you we'd be seeing more from Michael J Williams, and... here is that very same more!

He's taken it upon himself to rewrite the Avoiding game tutorial series into AS3, I know I'll be following it, so should you!

Click here to view the tutorial.

Thanks to Michael, bookmark his site!

16Sep/0814

Avoiding Game pt.5

The avoiding game tutorial series:
Part 1 Part 2 Part 3 Part 4 Part 5 Part 5b

This is part 5 of the avoiding game tutorial series, in which I have gradually shown you how to create an avoid and collect game. Make sure to read parts 1, 2, 3 and 4 before reading this, it'll all make much more sense that way!

In this part of the tutorial, we're going to add a simple character select screen to our game. This won't add -much- to gameplay (Unless you have different sized characters, which will increase or decrease the difficulty), however it will add to the overall impact of your game. I'll also show you a few tips to organising your game to make it easier to add more in later. (Something we didn't do very well earlier, my fault, wasn't expecting this tutorial to be so popular!)

So, let's see what you'll have after finishing this part!

Ok then, let's get to work!

A few changes, and a hint on organisation

First of all I need to show you a few changes you need to make before we continue. Because we will be adding extra frames in earlier on the timeline, some of our buttons will become pointed at the wrong frame. For example, putting a frame in between the current frame one and two, will mean our play game button sends us to the new frame.

Because we'll most likely want to add in more and more new features to our game as we go along, this could become an annoyance, updating our button numbers every time we want to add a new frame in, so instead we can label our frames, and send our buttons to those instead. Labels stay on the frame regardless of if you move the frame, and this makes them very handy for the indecisive among us who like to chop and change frame order, or those who forget to add them in earlier.

Button

Button

First, you'll need to change your Play button on your main menu. Replace the existing actionscript with the following:

  1. on(release){
  2. gotoAndStop("charselect");
  3. }

This charslect frame doesn't exist yet, we'll come to that in a moment. Whilst you're on the main menu screen, select the frame on the timeline and open up the properties box. Here you'll see an input text box for the Frame Label, label this frame 'menu'.

Menu

Menu

Now click onto your main game frame. Repeat the process above but instead label this frame 'game'. Easy eh?

Game Over

Game Over

The enterFrame function needs editing too, but only a little. Find the code below, and replace it with the code below that code.

  1. if (_root.lives<=0) {
  2. _root.gotoAndStop(3);
  3. this.removeMovieClip();
  4. }
  1. if (_root.lives<=0) {
  2. _root.gotoAndStop("gameover");
  3. this.removeMovieClip();
  4. }

Ok? Good. Now lets fix up our Game Over frame. Click onto it and label it 'gameover', then select the replay button and open the actions. Replace it's current actions with the following:

  1. on(release){
  2. gotoAndStop("game");
  3. }

As you may have guessed, the way we refer to Frame Labels is much the same as Frame Numbers, but when writing them in our Actionscript we must surround them by "s to make Flash recognise them as labels.

I highly encourage you to use Frame Labels in your projects, they make things so much easier! I'll be making a post soon going into other organisational techniques, they'll come in handy!

Create the character select screen

Insert a new frame between frames 2 and 3, and make sure it's blank of anything bar the background/menu design. Label it, 'charselect'. Then, draw your choice of characters (Make sure to include your current one!), for the purposes of this tutorial we'll have a choice of 3 different ones. Then convert each to a button.

Skull Buttons

Skull Buttons

Right. Now we have our frame setup, it's time to write some actionscript. On this frame's actions, you'll need to write the following:

  1. stop();
  2. character=0;

The stop will keep the timeline from moving on, and this 'character' variable is what we'll use to see which player the user wants for their character. Each of our buttons will change this variable, so let's write the script for those now.

Skull Script

Skull Script

  1. on(release){
  2. _root.character=1;
  3. _root.gotoAndStop("game");
  4. }

This can be copied onto the other two buttons, but remember to change character=1, to 2 and 3 for your consecutive characters!

That's the screen done, now onto the trickier part.

Setting up the player to change!

Switch over to your main game screen, and enter the player movieclip. You need to copy each new character into new frames, making sure the Frame Number they're on matches the variable you set on thier button earlier. Then just add a few stop(); actions, something like this:

Player Setup

Player Setup

All you need to do now is to switch back to your main game frame, and open up the actions for your player. We need to modify the onClipEvent(Load){, so replace it with this: (Make sure you leave the onClipEvent(enterFrame){ alone!!)

  1. onClipEvent (load) {
  2. _root.timeclock = setInterval(_root.timer, 1000);
  3. _root.enemyclock = setInterval(_root.enemytimer, 5000);
  4. if(_root.character==1){
  5. this.gotoAndStop(1);
  6. } else if(_root.character==2){
  7. this.gotoAndStop(2);
  8. } else{
  9. this.gotoAndStop(3);
  10. }
  11. }

!-EDIT-!

Michael J Williams has commented below with a much more efficient (And handy) way to handle the actual changing of the character, replace the following:

  1. if(_root.character==1){
  2. this.gotoAndStop(1);
  3. } else if(_root.character==2){
  4. this.gotoAndStop(2);
  5. } else{
  6. this.gotoAndStop(3);
  7. }

with:

  1. if(_root.character>=1){
  2. this.gotoAndStop(_root.character);
  3. }

Thanks Michael! (You may well be seeing more of him soon...)

Now, test your game, should all be working fine!

A few notes before I end with the generic 'give me suggestions'

Those of you converting this to use the arrow keys rather than the mouse may find this tutorial helpful.

And, those of you sending files to me for help need to send them to alternateaccount[AT]frozenhaddock.co.uk, and they need to be in Flash 8 format or below, I don't have CS3 yet! (And I doubt I ever will, what with CS4 being released rather soon)

Also, to those looking forward to my avoiding game, it should be out shortly, I'll post with a link when it is.

And now for my desperate begging, please comment with any ideas or suggestions you have for this, or indeed any tutorial! I have the next part of this planned for implementing some powerups, so if you have ideas for those make sure you comment below and I'll try my best to get them added in!

Grab the source.... here.