Journal:2008october25 researching flash game: Difference between revisions

From Robupixipedia
Jump to navigationJump to search
(Added tag: 'journal')
(suggested function)
Line 25: Line 25:
= First Research =
= First Research =


Okay, I still figure this problem is common, so I searched on [http://www.google.com/search?q=actionscript+game+tutorial&hl=en actionscript game tutorial], looked at the top hit: [http://www.developal.com/tutorials/tutorials262.html http://www.developal.com/tutorials/tutorials262.html], which gave me a broken link on their top hit, and then found [http://www.flashkit.com/tutorials/Games/Building-David_Do-611/index.php Building Games in Flash 5 - Part 3 - Enemies and collisions] by [http://www.artifactinteractive.com.au/ David Doull]
Okay, I still figure this problem is common, so I searched on [http://www.google.com/search?q=actionscript+game+tutorial&hl=en actionscript game tutorial], looked at the top hit: [http://www.developal.com/tutorials/tutorials262.html http://www.developal.com/tutorials/tutorials262.html], which gave me a broken link on their top hit, and then found [http://www.flashkit.com/tutorials/Games/Building-David_Do-611/index.php Building Games in Flash 5 - Part 3 - Enemies and collisions] by [http://www.artifactinteractive.com.au/ David Doull].
 
On [http://www.flashkit.com/tutorials/Games/Building-David_Do-611/more3.php page 3] of this, I found some code:
 
  onClipEvent (load) {
    function reset(){
      this._x=600;
      this._y=random(200)+100;
      enemySpeed=random(4)+1;
    }
    reset();
  }
 
which was suggested to be put in the movie clip's actionscript.
 
Oh!  So if we can do an '''onClipEvent (load)''', I bet there are [http://www.google.com/search?q=onclipevent&hl=en other onClipEvents].  Top hit gives me [http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary614.html http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary614.html], which shows that we can also do onClipEvent (unload).
 
= Try This =
 
  onClipEvent (unload) {
    function checkhit(){
      if(this.was_hit)
      {
        _root.success._visible = true;
      } else
      {
        _root.failure._visible = true;
      }
    }
    checkhit();
  }
 


led me to
[[Category:journal]]
[[Category:journal]]
[[Category:journal]]
[[Category:journal]]

Revision as of 19:49, 24 October 2008

The task

Make a Flash game that will detect if the user misses targets.

the problem

It's easy to detect if targets (buttons) are hit, but how do we know if they are *not* hit?

sub problem

Though I have two computers, I don't have the power supply for the one with Flash 8 installed.

sub solution

So I'm going to write these notes for what I think will work, but no guarantees. Once I've got my power supply for my white MacBook, I'll try to follow these notes.

therefore

Hopefully this page will become a tutorial that people can use to solve the main problem

First Post

I figure this problem should be pretty common, so I posted a message on Kirupa, asking how to detect if a button is not pressed. Two and a half days later (and counting), no answer.

First Research

Okay, I still figure this problem is common, so I searched on actionscript game tutorial, looked at the top hit: http://www.developal.com/tutorials/tutorials262.html, which gave me a broken link on their top hit, and then found Building Games in Flash 5 - Part 3 - Enemies and collisions by David Doull.

On page 3 of this, I found some code:

 onClipEvent (load) {
   function reset(){
     this._x=600;
     this._y=random(200)+100;
     enemySpeed=random(4)+1;
   }
   reset();
 }

which was suggested to be put in the movie clip's actionscript.

Oh! So if we can do an onClipEvent (load), I bet there are other onClipEvents. Top hit gives me http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary614.html, which shows that we can also do onClipEvent (unload).

Try This

 onClipEvent (unload) {
   function checkhit(){
     if(this.was_hit)
     {
       _root.success._visible = true;
     } else
     {
       _root.failure._visible = true;
     }
   }
   checkhit();
 }