Most asked questions |
Top Previous Next |
Q: In Aum6 there's a car demo script. How can I remove the damage code to make it invincible? A: Comment a single line:
action my_car {
............... // my.event = increase_damage; // comment this line
...............
}
Q: I started to create a game. When the player changes the level I want to play a cutscene movie, then a level1.wav file, load the second level and then play the level2.wav file. How can I do that? A: Use the code below:
sound level1_wav = <level1.wav>; sound level2_wav = <level2.wav>;
string level2_wmb = <level2.wmb>;
action level_12 // attach this action to the entity that changes from level1 to level2 { var shandle; while (vec_dist (my.x, player.x) > 50) {wait (1);} // wait until the player has come close enough shandle = media_play ("cutscene1.avi", null, 50); // now play the cut scene movie while (media_playing(shandle) != null) {wait (1);} // wait until it is finished shandle = snd_play (level1_wav, 50, 0); // start playing the first wave file while (snd_playing(shandle) != null) {wait (1);} // wait until the wave is played my = null; // keep the function running even after level_load level_load (level2_wmb); // load the second level wait (3); // wait until the level is loaded snd_play (level2_wav, 50, 0); // now play the new sound }
Q: How can I attach a weapon to the player in 1st person mode if I can't use a "entity" definition? A: Paste the code below at the end of your script file. The method works great for 1st and 3rd person cameras too.
string gun_mdl = <gun.mdl>;
function move_weapon();
starter player_gets_weapon() { while (player == null) {wait (1);} ent_create (gun_mdl, player.x, move_weapon); }
function move_weapon() { my.passable = on; while (1) { my.x = player.x + 5 * cos(player.pan) + 10 * sin(player.pan); // 5 quants in front of the player my.y = player.y + 5 * sin(player.pan) - 10 * cos(player.pan); // and 10 quants sideway (to the right) my.z = player.z + 40; // the height of the gun is set 40 quants above player's origin my.pan = player.pan; my.tilt = player.tilt; wait (1); } }
Q: When we shoot between the enemy legs we will hit the enemy instead of the ground. Can you help, please? A: The new A6 engine allows you to set the "polygon" flag for your enemies. Make sure to use physics entities for the bullets and you will get polygon-based collision detection.
Q: How could I create a splash screen? The player would have to press the "Space" key in order to continue to the game. A: Use the code below:
bmap splash_pcx = <splash.pcx>;
panel splash_pan { bmap = splash_pcx; pos_x = 0; pos_y = 0; layer = 1; flags = overlay, refresh; }
starter show_splash() { freeze_mode = 1; // stop all the entities in the level splash_pan.visible = on; // show the splash screen while (key_space == 0) {wait (1);} // wait until the "space" key is pressed while (key_space == 1) {wait (1);} // wait until the "space" key is released splash_pan.visible = off; freeze_mode = 0; // resume the gameplay }
Q: I was wondering how I can use the multidimensional arrays in A6.3. A: Multidimensional arrays are an experimental feature at the moment; they aren't included in the current (A6.3) release.
Q: How I can make a part of a house transparent, so that I can see the Soldiers inside it? A: Create the roof as a separate wmb entity and attach it the action transparent_roof. Move the mouse over the roof to make it transparent.
function set_transparency() { if (event_type == event_touch) { my.alpha = 60; // show the soldiers } if (event_type == event_release) { my.alpha = 100; } }
action transparent_roof { my.transparent = on; my.alpha = 100; my.enable_touch = on; my.enable_release = on; my.event = set_transparency; }
|