game error
valdes1978 - January 7, 2009 - 17:42
| Project: | Tetris |
| Version: | 6.x-1.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | valdes1978 |
| Status: | active |
Jump to:
Description
The game won't load.
| Project: | Tetris |
| Version: | 6.x-1.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | valdes1978 |
| Status: | active |
The game won't load.
#1
Error: tetris_initialize_game is not defined
Line: 83
#2
I am getting the same error for this, and for all of the related games: breakout, pong, etc. It appears on FireFox2 and 3, as well as IE7.
Here is the code displayed in the FireFox error console:
<script language='javascript' >tetris_modulepath='/modules/tetris-6.x-1.1/tetris'; tetris_start_message='Z Left, X Right, J rotate, M down. Click New Game to begin'; tetris_gameover_message='Game over.'; tetris_game_begins_message='The game begins'; tetris_keyboard=1; tetris_mouse=1; tetris_initial_game_speed='1500'; tetris_speed_increase_per_level='25'; tetris_piece1_img='/modules/tetris-6.x-1.1/tetris/img/orange.png'; tetris_piece2_img='/modules/tetris-6.x-1.1/tetris/img/red.png'; tetris_piece3_img='/modules/tetris-6.x-1.1/tetris/img/blue.png'; tetris_piece4_img='/modules/tetris-6.x-1.1/tetris/img/purple.png'; tetris_piece5_img='/modules/tetris-6.x-1.1/tetris/img/lightblue.png'; tetris_piece6_img='/modules/tetris-6.x-1.1/tetris/img/green.png'; tetris_piece7_img='/modules/tetris-6.x-1.1/tetris/img/yellow.png'; tetris_piece1_color='orange';tetris_piece2_color='red';tetris_piece3_color='blue';tetris_piece4_color='purple';tetris_piece5_color='cyan';tetris_piece6_color='green';tetris_piece7_color='yellow';tetris_number_columns=12; tetris_number_lines=22; tetris_scale=0.75; tetris_leftkey=90; tetris_rightkey=88; tetris_upkey=74; tetris_downkey=77; tetris_background='/modules/tetris-6.x-1.1/tetris/img/drupal.jpg'; tetris_background_transparency='0.2'; tetris_initialize_game(); </script></div><br/><input type="button" value="New game" onClick="blur(); tetris_initialize_game(); tetris_start_game();" /> <span align='right' style='font-size:0.6em'><a href='http://www.skinhat.com/drupal'>Skinhat</a></span><form id='tetris_winform' method='POST' action='/tetris/win' > <input type='hidden' id='tetris_win_message' name='tetris_win_message'/><input type='hidden' id='tetris_ticker' name='tetris_ticker'/><input type='hidden' id='tetris_win'/></form></div>Any help would be greatly appreciated.
Jim
#3
I found the problem. The code apparently assumes that drupal is in the top-level directory of the website. If it is in a subdirectory, as I have it, then the hard coded paths of "/modules/tetris/*" will fail miserably. I am working around this for the time being by have a duplicate modules directory containing the tetris (and other game) modules in my top directoy.
This should be classed as a fairly severe bug, IMHO.
Jim
#4
I made a folder modules with tetris inside and now it is working.
I guess this will be fixed with a later version of the game.
thanks for the workaround :)
#5
Perhaps I need to make it like in views (views.module):
$path = drupal_get_path('module', 'views');
require_once("./$path/views_cache.inc");
with a dot and slash in the front. That wouldnt be the root any more would it?
#6
bump
#7
Looking at other modules code if you add a .js script to your module you should use drupal_add_js() instead of coding the .js file in yourself. I've now updated my modules so uses drupal_add_js() instead. Hopefully this will fix the problem.
#8
Just take the tetris.js file out of the folder, change it to tetris.txt, open it, use "replace all". If the name of your Drupal Directory is something like "Yeahdude" , then replace:
/modules/
with
/Yeahdude/modules/
Then flip the file back into tetris.js, and replace tetris.js in your module with the new one. I just did it, and it works fine, except you need to do something for the background image too. I haven't figured that out yet. Too busy playing Tetris.