Is the sleep() function not supported in HTML version of GM? I have the below code, which works ok in windows export, but the seep fails to happen in HTML export:
// columns
for(i=0;i<14;i+=1)
{
// rows
for(j=0;j<14;j+=1)
{
if(j==3 || j = 9 || j == 13)
{
sleep(250); // wait here
instance_create(i*32,j*32,objWall);
screen_redraw();
}
} // end inner for
} // end outer for
Also, where is a good guide to what is and is not supported? The docs I have for the HTML5 version seem to be the wrong documentation.
Cheers,
Andy
- Game Maker Community
- → Viewing Profile: Topics: _247056
_247056
Member Since 13 Jan 2012Offline Last Active May 27 2012 12:37 PM
Community Stats
- Group New Member
- Active Posts 22
- Profile Views 440
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Male
-
Version
GM:HTML5
0
none
Friends
_247056 hasn't added any friends yet.
Topics I've Started
Sleep support
04 March 2012 - 09:16 AM
Animated Level display
04 March 2012 - 03:50 AM
So I have a game, it uses insatnces of wall, ball, and bonus - and is basically a strategy / puzzle game.
What I want is for the Level to start/load with each of the instances showing one after the other (say, 250ms delay). As in, you see the wall being laid out, one block drawn after the other until finally the Level is fully 'drawn' and ready to play.
What I have tried, with no luck at all, is a few variations of the below code attached to different events (draw, step, create etc). Ultimately, the levels will be represented in an XML file, and it this file that will be looped through to draw the walls, balls etc. (This will allow for user level creation, sharing etc).
if(global.drawGame)
{
// columns
for(i=0;i<14;i+=1)
{
// rows
for(j=0;j<14;j+=1)
{
if(j==3 || j = 9 || j == 13)
{
sleep(250); // Sleep here while wait for next block to be shown
instance_create(i*32,j*32,objWall);
}
} // end inner for
} // end outer for
}
global.drawGame = false;
Anyone have any ideas on how I need to go about this? I seem to be on the wrong track!
Cheers,
Andy
What I want is for the Level to start/load with each of the instances showing one after the other (say, 250ms delay). As in, you see the wall being laid out, one block drawn after the other until finally the Level is fully 'drawn' and ready to play.
What I have tried, with no luck at all, is a few variations of the below code attached to different events (draw, step, create etc). Ultimately, the levels will be represented in an XML file, and it this file that will be looped through to draw the walls, balls etc. (This will allow for user level creation, sharing etc).
if(global.drawGame)
{
// columns
for(i=0;i<14;i+=1)
{
// rows
for(j=0;j<14;j+=1)
{
if(j==3 || j = 9 || j == 13)
{
sleep(250); // Sleep here while wait for next block to be shown
instance_create(i*32,j*32,objWall);
}
} // end inner for
} // end outer for
}
global.drawGame = false;
Anyone have any ideas on how I need to go about this? I seem to be on the wrong track!
Cheers,
Andy
Animate Level
04 March 2012 - 03:45 AM
So I have a game, it uses insatnces of wall, ball, and bonus - and is basically a strategy / puzzle game.
What I want is for the Level to start/load with each of the instances showing one after the other (say, 250ms delay). As in, you see the wall being laid out, one block drawn after the other until finally the Level is fully 'drawn' and ready to play.
What I hav tried, with no luck at all, is a few variations of the below code attached to different events (draw, step, create etc):
if(global.drawGame)
{
// columns
for(i=0;i<14;i+=1)
{
// rows
for(j=0;j<14;j+=1)
{
if(j==3 || j = 9 || j == 13)
{sleep(250);
instance_create(i*32,j*32,objWall);
}
} // end inner for
} // end outer for
}
global.drawGame = false;
What I want is for the Level to start/load with each of the instances showing one after the other (say, 250ms delay). As in, you see the wall being laid out, one block drawn after the other until finally the Level is fully 'drawn' and ready to play.
What I hav tried, with no luck at all, is a few variations of the below code attached to different events (draw, step, create etc):
if(global.drawGame)
{
// columns
for(i=0;i<14;i+=1)
{
// rows
for(j=0;j<14;j+=1)
{
if(j==3 || j = 9 || j == 13)
{sleep(250);
instance_create(i*32,j*32,objWall);
}
} // end inner for
} // end outer for
}
global.drawGame = false;
Weird object trails appearing
11 February 2012 - 01:47 PM
When I use the move actions, like move toward point and move random, my object moves but leaves a trail of itself behind!! The objects in the trail do not respond to asscoaited actions, which suggests it may be a draw issue?? I reproduced this in a new object that was free of any complications (such as step events).
This may have been hidden by a background all along, as I noticied this only when I removed the rooms background. I dont get how/why a background could hide or stop this trailing object behaviour??
I have also noted off interface behviour in the GM editor itself - all the text input fields have turned black and I can no longer see the text within them. Thsi may be unrelated, so I will contact support about that -but mentioing it in case it waas somehow related.
Cheers,
Andy
This may have been hidden by a background all along, as I noticied this only when I removed the rooms background. I dont get how/why a background could hide or stop this trailing object behaviour??
I have also noted off interface behviour in the GM editor itself - all the text input fields have turned black and I can no longer see the text within them. Thsi may be unrelated, so I will contact support about that -but mentioing it in case it waas somehow related.
Cheers,
Andy
wav woes
04 February 2012 - 09:32 AM
Hi All,
I was advised that wav files are the best choice for sound effects, and steered away from mp3 (as there is apparently a delay as the mp3 is unenecoded - and this delay is noticable in my game)
So my issue is that no matter what I do in GM:HTML5 it will not use my wav file, and instead exports and uses the mp3 version. In fact, once I use a wav file GM creates the ogg and mp3 version automatically and totally ignores my wav file.
Anyhoo, to get around this I stopped using the sound resource and directly loaded the file:
global.mysound=sound_add( 'html5game/sndCannotMove.wav', 0, 1 );
sound_play( global.mysound );
The sound location/url is correct, it is just 8k in size, plays perfectly in stand alone players, but will not play in html5 (chrome and safari). Directly visiting the sound file as a URL both browsers prompt me to save the file as they have no idea how to open or play it (but at least I know they can see it). I'm currently trying to figure out if I can set up a mime type in whatever web server GM is using (yet to investigate, and not feeling hopeful).
In summary - GM will not let me export a wav file, insiting on exporting/using an mp3, and directly referencing a wav seems to be problematic with the browsers I have. mp3 is not a solution as there is a delay when it responds to my click events.
Any tips much appreciated
Cheers,
Andy
I was advised that wav files are the best choice for sound effects, and steered away from mp3 (as there is apparently a delay as the mp3 is unenecoded - and this delay is noticable in my game)
So my issue is that no matter what I do in GM:HTML5 it will not use my wav file, and instead exports and uses the mp3 version. In fact, once I use a wav file GM creates the ogg and mp3 version automatically and totally ignores my wav file.
Anyhoo, to get around this I stopped using the sound resource and directly loaded the file:
global.mysound=sound_add( 'html5game/sndCannotMove.wav', 0, 1 );
sound_play( global.mysound );
The sound location/url is correct, it is just 8k in size, plays perfectly in stand alone players, but will not play in html5 (chrome and safari). Directly visiting the sound file as a URL both browsers prompt me to save the file as they have no idea how to open or play it (but at least I know they can see it). I'm currently trying to figure out if I can set up a mime type in whatever web server GM is using (yet to investigate, and not feeling hopeful).
In summary - GM will not let me export a wav file, insiting on exporting/using an mp3, and directly referencing a wav seems to be problematic with the browsers I have. mp3 is not a solution as there is a delay when it responds to my click events.
Any tips much appreciated
Cheers,
Andy
- Game Maker Community
- → Viewing Profile: Topics: _247056
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content