Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48

Thread: [DHTML] Cross-Browser Snake

  1. #1
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default [DHTML] Cross-Browser Snake

    1) CODE TITLE: Cross-Browser Snake

    2) AUTHOR NAME/NOTES:Brady Mulhollem

    3) DESCRIPTION:
    A simple snake game. Tested in IE 5+,FF1+,Opera 7.5+,and the latest Safari release.

    4) URL TO CODE: Demo
    Edit: Updated link to version with Konqueror support(buggy).
    Last edited by blm126; 08-09-2006 at 04:43 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Pretty good

    If you want to improve it, I'd eliminate most of those global variables, and maybe object-orient it so it's easier to work with and modify.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Umm.. What exactly does it do?
    - Mike

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's a game of Snake. Click one of the speeds at the bottom to start, then use the arrow keys to try to grab the "apple" (the red dot). Don't crash into the walls or yourself.
    /EDIT: Argh, got to 53 on medium then hit myself.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by mburt
    Umm.. What exactly does it do?
    That reminds me... I need to add directions.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Lol, it's Snake. What more is there to say?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    hmmm....
    I'm trying to make an object oriented version...but how do you call setTimout on an object method?

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You need to keep an index of all instances of the object.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Ok,well here's an object oriented version. It works fine in IE 5.0, IE 6, IE 7,FF1+,and Opera 7.5 +. It crashes IE 5.5 for some reason,and I haven't gotten a chance to test safari.
    Last edited by blm126; 08-10-2006 at 01:21 AM.

  10. #10
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yeah, I could play this for hours
    - Mike

Bookmarks

Posting Permissions

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