relaxis wrote:I was given this code in order to create a flashing button in a loop but I can't get it to work!!
If you put this code in a Draw Actor event, your actor will flash:
- Code: Select all
if(transp == 1.0) transp = 0;
else if(transp == 0.0) transp = 1.0;
I also need to create a piece of code that responds to certain controls throughout the game, it needs to be so that at any point in the game, if L and R and START are pressed all together, the game exits. I need also to incorporate some kind of volume control.
You can see an exit and volume control work example here:
http://game-editor.com/examples/gp2x.zip To exit the game when L, R and START are pressed together, just use a Key Down event, put the keys L, R and S (map the GP2X Start -> S in the Game Properties), select the option 'All keys are pressed' and put the code:
- Code: Select all
ExitGame();
To use the keys + and - to control the volume, remap the volume keys in the Game Properties panel:
GP2X Volume Up -> [+]
GP2X Volume Down -> [-]
Now, in a Key Down event for the key - with repeat enable put:
- Code: Select all
//Set music
musicvol -= .01;
if(musicvol < 0.0) musicvol = 0.0;
//Set all sound channels
setVolume(0, musicvol);
In a Key Down event for the key + with repeat enable put:
- Code: Select all
//Set music
musicvol += .01;
if(musicvol > 1.0) musicvol = 1.0;
//Set all sound channels
setVolume(0, musicvol);
To mute the sounds, use a Key Down event for the keys - and + with repeat disable, 'All keys are pressed' option, and put:
- Code: Select all
//Set music
musicvol = 0.0;
//Set all sound channels
setVolume(0, musicvol);
Can someone show me a working example of loading a DAT file?
If you have the game level2.ged to load, just use the code:
- Code: Select all
LoadGame("level2.ged");
This will load the level2.dat file in the exported game and level2.ged file in the editor.
More info here:
http://www.game-editor.com/docs/script_ ... m#loadgame
http://game-editor.com/games/breakout.zip