Notices

Go Back   Dynamic Drive Forums > DD Scripts > Dynamic Drive scripts help > Submit a DHTML or CSS code
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-05-2006, 10:45 PM
blm126's Avatar
blm126 blm126 is offline
Senior Coders
 
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.
Reply With Quote
  #2  
Old 08-05-2006, 11:17 PM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
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!
Reply With Quote
  #3  
Old 08-05-2006, 11:29 PM
mburt's Avatar
mburt mburt is offline
Elite Coders
 
Join Date: Jul 2006
Location: Canada
Posts: 2,507
Thanks: 5
Thanked 22 Times in 22 Posts
Default

Umm.. What exactly does it do?
Reply With Quote
  #4  
Old 08-05-2006, 11:41 PM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
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!
Reply With Quote
  #5  
Old 08-05-2006, 11:53 PM
blm126's Avatar
blm126 blm126 is offline
Senior Coders
 
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.
Reply With Quote
  #6  
Old 08-06-2006, 12:13 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
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!
Reply With Quote
  #7  
Old 08-06-2006, 01:07 AM
blm126's Avatar
blm126 blm126 is offline
Senior Coders
 
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?
Reply With Quote
  #8  
Old 08-06-2006, 01:09 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
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!
Reply With Quote
  #9  
Old 08-06-2006, 03:29 AM
blm126's Avatar
blm126 blm126 is offline
Senior Coders
 
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.
Reply With Quote
  #10  
Old 08-06-2006, 01:53 PM
mburt's Avatar
mburt mburt is offline
Elite Coders
 
Join Date: Jul 2006
Location: Canada
Posts: 2,507
Thanks: 5
Thanked 22 Times in 22 Posts
Default

Yeah, I could play this for hours
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:02 PM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.