A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 35 of 35

Thread: Game creation

  1. #21
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087

    that's what I get for using someone elses script

    The script that the guy used was bad. I'm repairing it now.

    this is what it should have looked like if you had done it corectly.

    <HTML>
    <HEAD>
    <TITLE>Find the Ball</TITLE>

    <SCRIPT LANGUAGE="JavaScript">
    var a=0
    function Randomise(maxValue) {
    currentdate = new Date ()
    seconds = currentdate.getSeconds()
    return (seconds % maxValue);
    }

    function MakeArray(size) {
    this.length = size;
    for(var g = 1; g <=size; g++);
    {
    this[g] = 0;
    }
    return this;
    }

    function getSwish() {
    swishArray = new MakeArray(20);
    swishArray[1] = "mov1.swf";
    swishArray[2] = "mov2.swf";
    swishArray[3] = "mov3.swf";
    swishArray[4] = "mov2.swf";
    swishArray[5] = "mov1.swf";
    swishArray[6] = "mov3.swf";
    swishArray[7] = "mov1.swf";
    swishArray[8] = "mov1.swf";
    swishArray[9] = "mov3.swf";
    swishArray[10] = "mov2.swf";
    swishArray[11] = "mov3.swf";
    swishArray[12] = "mov1.swf";
    swishArray[13] = "mov1.swf";
    swishArray[14] = "mov2.swf";
    swishArray[15] = "mov3.swf";
    swishArray[16] = "mov2.swf";
    swishArray[17] = "mov3.swf";
    swishArray[18] = "mov2.swf";
    swishArray[19] = "mov3.swf";
    swishArray[20] = "mov1.swf";
    randSwish = swishArray[Randomise(20)];
    return randSwish;
    }

    </SCRIPT>
    </HEAD>

    <BODY BGCOLOR="#009900"> <form name="first_form">
    <input type="number" name="first_text" value="">
    </form>


    <P ALIGN="center">
    <SCRIPT LANGUAGE="JavaScript">
    document.writeln(" <OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
    document.writeln(" codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' ");
    document.writeln(" ID=Untitled WIDTH=400 HEIGHT=250> ");
    document.writeln(" <PARAM NAME=movie VALUE='"+getSwish()+"'> ");
    document.writeln(" <PARAM NAME=loop VALUE=false> ");
    document.writeln(" <PARAM NAME=menu VALUE=false> ");
    document.writeln(" <PARAM NAME=quality VALUE=high> ");
    document.writeln(" <PARAM NAME=bgcolor VALUE=#009900> ");
    document.writeln(' <PARAM NAME="loop" value="true"> ');
    document.writeln( "</OBJECT>");
    </SCRIPT>

    </BODY>
    </HTML>


  2. #22
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Okay,

    This is giving me a headache.

    This is what I've got:

    <HTML>
    <HEAD>
    <TITLE>Game script</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    var a=0
    var r1=1
    var r2=3
    function Randomise(r1, r2) {
    if (r2 > r1) return (Math.round(Math.random()*(r2-r1))+r1);
    else return (Math.round(Math.random()*(r1-r2))+r2);
    }
    function MakeArray(size) {
    this.length = size;
    for(var g = 1; g <=size; g++);
    {
    this[g] = 0;
    }
    return this;
    }
    function getSWF() {
    sWFArray = new MakeArray(3);
    SWFArray[1] = "mov1.swf";
    SWFArray[2] = "mov2.swf";
    SWFArray[3] = "mov3.swf";

    randSWF = SWFArray[Randomise(r1,r2)];
    return randSWF;
    }

    function drawme() {
    document.writeln('<BODY BGCOLOR="#009900"> <form name="first_form"><input type=&qtnumber&qt name=&qtfirst_text&qt value=></form>');
    document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
    document.writeln(" codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' ");
    document.writeln(" ID=Untitled WIDTH=400 HEIGHT=250> ");
    document.writeln(" <PARAM NAME=movie VALUE='"+getSWF()+"'> ");
    document.writeln(" <PARAM NAME=loop VALUE=false> ");
    document.writeln(" <PARAM NAME=menu VALUE=false> ");
    document.writeln(" <PARAM NAME=quality VALUE=high> ");
    document.writeln(" <PARAM NAME=bgcolor VALUE=#009900> ");
    document.writeln(' <PARAM NAME="loop" value="true"> ');
    document.writeln( "</OBJECT></center>");
    }
    </SCRIPT>
    </HEAD>
    <BODY BGCOLOR="#009900" onLoad="drawme();">
    </BODY>
    </HTML>

    The problem is that when this loads it replaces the HTML with the whats in the Writeln area instead of the just writting it to the page. If someone knows what I'm doing wrong help please. The other problem is that this should Loop, but is not? Why is it not looping?





  3. #23
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Okay,

    I got it the first part to work.

    <HTML>
    <HEAD>
    <TITLE>Game script</TITLE>

    <SCRIPT LANGUAGE="JavaScript">
    var a=0
    var r1=1
    var r2=3

    function Randomise(r1, r2) {
    if (r2 > r1) return (Math.round(Math.random()*(r2-r1))+r1);
    else return (Math.round(Math.random()*(r1-r2))+r2);
    }
    function MakeArray(size) {
    this.length = size;
    for(var g = 1; g <=size; g++);
    {
    this[g] = 0;
    }
    return this;
    }



    function getSwish() {
    swishArray = new MakeArray(3);
    swishArray[1] = "mov1.swf";
    swishArray[2] = "mov2.swf";
    swishArray[3] = "mov3.swf";

    randSwish = swishArray[Randomise(r1,r2)];
    return randSwish;
    }

    function drawme() {
    document.writeln('<BODY BGCOLOR="#009900"> <form name="first_form"><input type=&qtnumber&qt name=&qtfirst_text&qt value=></form>');
    document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
    document.writeln(" codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' ");
    document.writeln(" ID=Untitled WIDTH=400 HEIGHT=250> ");
    document.writeln(" <PARAM NAME=movie VALUE='"+getSwish()+"'> ");
    document.writeln(" <PARAM NAME=loop VALUE=false> ");
    document.writeln(" <PARAM NAME=menu VALUE=false> ");
    document.writeln(" <PARAM NAME=quality VALUE=high> ");
    document.writeln(" <PARAM NAME=bgcolor VALUE=#009900> ");
    document.writeln(' <PARAM NAME="loop" value="true"> ');
    document.writeln( "</OBJECT></center>");
    }


    </SCRIPT>
    </HEAD>

    <BODY BGCOLOR="#009900">
    <script>
    window.onLoad=drawme()
    </script>


    I just need to get it to do the functions again without erasing the whole thing.

  4. #24
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087

    what you have there is good

    Guys what we have here is a script that will Draw a Random SWF and display it. Remove the "" from around the loop param to make it loop. This script has many uses.

    Note-this only works in IE- I cut the Netscape section.

  5. #25
    Senior Member
    Join Date
    Aug 2000
    Posts
    766

    um...

    Ok I think I have been away to long, looks like you been busy again. Ok I did try what you suggested, and it didn't work, I see that you found something wrong with the randomizer script. So is the last one the fixed one, ok explain to me which .html this is going to go into, and could you explain to me what was wrong, maybe my ole brain can learn something.

    Thanks

    Brad

  6. #26
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    What you see there is the HTML.

    All you have to do is cut and Paste.

    In the above example r1 and r2 set the random number variables parameters. What I am asying is in var r1=1 var r2=3 is setting it up so that the computer picks a number between 1 and 3.


    Randomise is the actual function that picks the Random number.


    MakeArray function does just that it makes an array.
    The getSwish function calls the makeArray function and assigns a 3 URL's to the variable array called swishArray.
    It then creates a variable called randomswish by choosing one of the three URL's and finaly it returns the URL value to getSwish.

    function drawme actually draws the Direct X object (the SWF) to the page. It draws the swf specified in make array. Please note that I chopped the Netscape script and detection from this for debugging purposes- I had several bugs, typing and case errors, when I first put this together.

    Then in the Body:

    The first line declares the Body section and makes the background green.

    The next section declares a new script. The new script calls the function Drawme on load.

    I was wanting to just call the drawme function in the SWF. This does not work and its not suppose to. After a document is displayed the writeln and write functions will replace your HTML which means we get no benifit from having or stuff in the function drawme. I had to look that up. I think that what we are wanting to do to make this work is instead of using this: ;window.document.refresh we want to use this ;window.document.reload(). I have yet to try it though. I'm sure I still have a bug somewhere. Anyhow later tonight I have it debugged and ready for you.

    The other thing we can do besides use the reload script is to use DHTML to make this work. We may have to.




  7. #27
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087

    Yuck!

    I have everthing but the score keeper thing working.

    <HTML>
    <HEAD>
    <TITLE>Game script</TITLE>

    <SCRIPT LANGUAGE="JavaScript">
    var a=1;
    var r1=1
    var r2=3
    a=a++
    function Randomise(r1, r2) {
    if (r2 > r1) return (Math.round(Math.random()*(r2-r1))+r1);
    else return (Math.round(Math.random()*(r1-r2))+r2);
    }
    function MakeArray(size) {
    this.length = size;
    for(var g = 1; g <=size; g++);
    {
    this[g] = 0;
    }
    return this;
    }



    function getSwish() {
    swishArray = new MakeArray(3);
    swishArray[1] = "mov1.swf";
    swishArray[2] = "mov2.swf";
    swishArray[3] = "mov3.swf";

    randSwish = swishArray[Randomise(r1,r2)];
    return randSwish;
    }

    function drawme() {
    document.writeln('<BODY BGCOLOR="#009900"> ');
    document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
    document.writeln(" codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' ");
    document.writeln(" ID=Untitled WIDTH=400 HEIGHT=250> ");
    document.writeln(" <PARAM NAME=movie VALUE='"+getSwish()+"'> ");
    document.writeln(" <PARAM NAME=loop VALUE=false> ");
    document.writeln(" <PARAM NAME=menu VALUE=false> ");
    document.writeln(" <PARAM NAME=quality VALUE=high> ");
    document.writeln(" <PARAM NAME=bgcolor VALUE=#009900> ");
    document.writeln(' <PARAM NAME=loop value=true> ');
    document.writeln( "</OBJECT>");
    }
    function reloadIt() { a=a+1;location.reload();}

    </SCRIPT>
    </HEAD>

    <BODY BGCOLOR="#009900">
    <center><form name="first_form"><input type="number" name="first_text" value=></form><script name="ed">
    window.onLoad=drawme()
    window.document.first_form.first_text.value=a
    </script></center>
    </body>
    </html>

  8. #28
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I hate to say it but I'm thinking perhaps frames are going to need to be involved.


  9. #29
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Oh Yeah, almost forgot. This is what jumps into the get URL line:

    javascript:

  10. #30
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Oh Yeah, almost forgot. This is what jumps into the get URL line:

    javascript: reloadIt();window.document.refresh


    I was thinking though, If I call drawme then it replaces the HTML. Perhaps what we need to do is call drawme but on a Frame instead of itself. This should leave the original code alone and allow us to change the other. HMMMM.....

  11. #31
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    You know this is completely different from the original right? Looks less complicated. I think I get most of it. I won't be able to work on it till probally, tomorrow night, and I will try to work on the KoolKit site, as well, since there is so much to add. Busy, busy.

    Brad

  12. #32
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I rewrote it.

  13. #33
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I think that I know of a workaround so that we will not have to use Frames for the script. I will work on it tonight.

  14. #34
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    I will try to work on it tonight too, as well as fix a bug on the KoolKit site. I will send you the zip of the KoolKit logo tonight. My internet computer is on the frix. I hope to have it up and running tonight.

    Brad

  15. #35
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I got held up.

    The way to triple nest quotes is to use " ' &quot;
    will fix later tonight.

    The fix is rather simple or complicated depending on how you want to look at it. The whole page must be declared as a function and then redeclared. Then when you call the function it'll write the whole HTML.


    Its rather complicated and involves tripple nesting quotes which should be imposible but thanks to Front Page's ability and eagerness to change code without you telling it to it is possibe.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center