Game creation
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 35

Thread: Game creation

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    This is a script from the Swish board it draws a semi random SWF on the screen.

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

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

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

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

    </SCRIPT>
    </HEAD>

    <BODY BGCOLOR="#009900">

    <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(" <EMBED src='"+getSwish()+"' quality=high bgcolor=#009900 loop=false menu=false ");
    document.writeln(" WIDTH=400 HEIGHT=250 TYPE='application/x-shockwave-flash' ");
    document.writeln(" PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'> ");
    document.writeln(" </EMBED> ");
    document.writeln(" </OBJECT> ");
    </SCRIPT>
    </P>

    </BODY>
    </HTML>

    Brad; toss in my score script, some sticky shapes-for cursors, and your missle SWF's and we have a complete game.


    [Edited by johnie on 10-21-2000 at 02:48 PM]

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    um...sticky shapes?

    Brad

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    You remember my little button thing?

    Draw a shape and then make it 100% transparent. Make it a button and then make the on over state solid. Copy that shape so that you have a bunch of those buttons all over your screen- Group them and then copy it to all of the Frames. Viola- a hash cursor.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Just make sure that the over state is not filled-

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

    I decided to repost my example.

    [swf width="150" height="100" background="#000000"]http://www.geocities.com/jsnider.geo/stickyshapes.swf[/swf]

    Mouse over the square.

    Now if you make the insides of those circles (or use sights) transparent and have your missles underneath then you could have a cursor.


  6. #6
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Right after I asked my question I understood
    Will fix the game today
    Brad

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Johnie-
    I am confused with how the score board works, as well as the random, how does it draw the missiles, um, and how do I get the missile object to be variable a, maybe I am just tired, appreciate your help.

    Brad

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    You are going to make 3 or 4 swf's.

    I recommend a start URL that loads the The game itself. The game itself must be embedded on a HTML. The HTML will contain that script. Make 3 or 4 Missle positions. Add the action in my tutorial on Javascript at http://www.koolmoves.com. You will also have to add that text area. The shapes will contain that get URL action that I have in the tutorial. I believe it was javascript: a=a+1;window.document.textarea[name].text[name]value=a;document.window.refresh.

    The last thing you will do is create a URL with the game over section and replay section that will redirect them back to the opener URL.

    Okay- I'll make an example.




  9. #9

  10. #10
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    I get it now, I got confused with what gets what script, etc. etc.

    Thanks

    Brad

  11. #11
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Originally posted by BradBradleySL
    Johnie-
    I am confused with how the score board works, as well as the random, how does it draw the missiles, um, and how do I get the missile object to be variable a, maybe I am just tired, appreciate your help.

    Brad
    The person who original wrote the random script named his movies tumbler1.swf; tumbler2.swf; tumbler3.swf. With the script that is there you can have up to 20 different swfs.

    You probably want to name your swf's something besides tumbler. Change the script reflect that.

    What the script does is looks at the date and time then generates a semi-random number from that. It then sets up an aray and then assigns it to a var.

    Instead of writing the SWF to a page in standard methods it writes it to the page with the javascript write.line calls to the built in form object. Instead of the normal methods it allows you to switch the SWF on the page. This is important because we want to keep var info to keep score.



  12. #12
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Ahhhh, now I really get it, can't translate javascript that well, but now that i look at it, after what you said I see what you mean. Thanks, i gotta study javascript more.

    Brad

  13. #13
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    http://www.webmonkey.com

    has the best intro to java script tutorial around. It is even better than the Javascript for dummies book.

  14. #14
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Yeah I have been to webmonkey, my problem with javascript and programming in general is the relation to mathematics, I can memorize all the commands, equations, and such but I have trouble reorganizing them into applications, but I will learn, never should have quit at basic, got to into photoshop and such and just stopped studying

    Brad

  15. #15
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I was lucky I learned basic first.

    My problem was with learning OOP. The classes and inhertance confused me a bit.

  16. #16
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    I am in the process of learning to use Delphi, I am going to try and make a good autotracer, I know there are some really good ones out there, but they cost a fortune, I want to make my own, I think thats the great thing about programming, you can make your own programs, for what you need.

    Brad

  17. #17
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Ok, it didn't work, script error, I am going over it

    Brad

  18. #18
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Ok Johnie-

    With your tutorial, you say to add-
    <form name="first_form......etc. etc.
    do you have to add the <script> before that?

    Brad

  19. #19
    Senior Member
    Join Date
    Aug 2000
    Posts
    766

    aggggh..ok heres the html.

    I probally have one little letter in wrong, but here-
    tell me if you see anything


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
    <SCRIPT>var a=0</SCRIPT>

    <TITLE></TITLE>

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

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

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

    </SCRIPT>

    </HEAD>
    <BODY BGCOLOR="#ffffff">


    <CENTER>
    <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" ALIGN="Center" WIDTH="320">
    <TR>
    <TD><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" id=game width=700 height=300 codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0,0">
    <param name="movie" value="game.swf">
    <param name="quality" value="high">
    <param name="play" value="true">
    <param name="loop" value="true">
    <param name="bgcolor" value="#ffffff">
    <SCRIPT LANGUAGE=JavaScript>
    <!--
    <form name="first_form">
    <input type="number" name="first_text" value="">
    </form>
    var ShockMode = 0;
    if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
    if (navigator.plugins && navigator.plugins["Shockwave Flash"])
    ShockMode = 1;
    } if (ShockMode ) {
    document.write('<embed src="game.swf"');
    document.write(' width=700 height=300 bgcolor="#ffffff" quality="high" loop="true"');
    document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/">');
    document.write('</EMBED>');
    } else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)) { document.write('<IMG SRC="nonflash.gif" width=700 height=300');
    }
    //-->
    </SCRIPT><NOEMBED><IMG SRC="nonflash.gif" width=700 height=300 BORDER=0></NOEMBED><NOSCRIPT><IMG SRC="nonflash.gif" width=700 height=300 BORDER=0></NOSCRIPT></OBJECT></TD>
    </TR>
    </TABLE>
    </CENTER>
    </BODY>
    </HTML>



    Thank you
    Brad


  20. #20
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    No do not add script tags to it


    I see four mistakes and one of them is mine.

    1. change the g to i in the top of the script.

    2. In the script tags add this var a=0

    3. Move the Form above the object tag. Place it right after the <center> tag. Forms do not get placed in <script> tags. That will really screw it up.

    4. The script as you have written won't do anything. The writln things were important. You must use them as they were in the original code that I posted .

    See if that helps.

    I'll throw together an HTML and give it to you.



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

Poll by Flashkit.com