Most asked questions

Top  Previous  Next

Q: How can I create a main menu that includes a fire effect like in Quake3?

A: Place the letters in a 3D level, create paths that surround each letter and use the code below:

 

action patrol_path // attach this action to your fire sprite
{
       my.ambient = 100;
       my.flare = on;
       my.skill10 = path_scan (my, my.x, my.pan, vector(360, 180, 1000));
       if (my.skill10 == 0) {return;} // no path was found
       ent_waypoint(my.skill1, 1); // start with the first vertex on the path
       while (1)
       {
               temp.x = my.skill1 - my.x;
               temp.y = my.skill2 - my.y;
               temp.z = 0;
               result = vec_to_angle (my_angle, temp);
               if (result < 10)
               {
                       ent_nextpoint(my.skill1);
               }
               my.x = my.skill1;
               my.y = my.skill2;
               sleep (0.1); // play with this value if you need to change the speed
       }
}

 

Q: I'd like to have a fly through, as well as a player's camera in my game. Can you help?

A: Place a small entity in your level and attach it the action named camera2; press "C" to toggle the cameras.

 

view second_camera

{

}

 

action camera2

{

  second_camera.pos_x = 0;

  second_camera.pos_y = 0;

  second_camera.size_x = screen_size.x;

  second_camera.size_y = screen_size.y;

  second_camera.visible = off;

  camera.visible = on;

  my.invisible = on;

  while (1)

  {

     vec_set(second_camera.x, my.x);

     second_camera.pan = my.pan;

     second_camera.tilt = my.tilt;

     my.pan -= 10 * mouse_force.x * time;

     my.tilt += 10 * mouse_force.y * time;

     move_mode = ignore_passable + glide;

     ent_move (vector (10 * (key_w - key_s) * time, 0, 0), nullvector); // use "W" and "S" to move the camera

     wait (1);

  }

}

 

function switch_cameras()

{

  camera.visible = (camera.visible == off);

  second_camera.visible = (camera.visible == off);

}

 

on_c = switch_cameras;

 

 

Q: Anyone knows how can I resize the in-game view" I have the game running at 1024x768 resolution, but I want to have a panel with a size of 1024x200 at the bottom of the screen and have the game running inside a 1024x568 window.

A: Use this snippet:

 

bmap bottom_pcx = <bottom.pcx>;

 

panel bottom_pan

{

  pos_x = 0;

  pos_y = 568;

  bmap = bottom_pcx;

  layer = 15;

  flags = overlay, refresh, visible;

}

 

starter camera_568()

{

  camera.pos_x = 0;

  camera.pos_y = 0;

  camera.size_x = 1024;

  camera.size_y = 568;

}

 

aum49_questions1

Q: How can I add several actions to one entity?

A: You can't do that directly, but here's a workaround; let’s say that you want to add 3 actions to an entity:

 

action one

{

  my.ambient = 100;

}

 

action two

{

  my.transparent = on;

}

 

action three

{

  my.z = 200;

}

 

Keep the first action and change the 2nd and 3rd to functions:

 

function two(); // function declaration, place it at the top of the script

function three(); // function declaration, place it at the top of the script

 

function two()

{

  my.transparent = on;

}

 

function three()

{

  my.z = 200;

}

 

Now call function two and function three from within action one:

 

action one // attach this action to your entity

{

  my.ambient = 100;

  two();

  three();

}

 

That’s it!

 

 

Q: I'd like to have entities that react when "space" is pressed, if they are "touched" by the crosshair. How can I do that?

A: Use the code below:

 

bmap mypointer_pcx = <mypointer.pcx>;

 

function touched_by_pointer();

 

starter mouse_in_center()

{

  mouse_map = mypointer_pcx; // set the mouse pointer bitmap

  mouse_pos.x = (screen_size.x - bmap_width(mypointer_pcx)) / 2; // place the pointer in the center of the screen

  mouse_pos.y = (screen_size.y - bmap_height(mypointer_pcx)) / 2; // on the x and y axis

  mouse_range = 5000; // objects of up to 5000 quants away can be touched by the mouse

  mouse_mode = 2; // show the pointer

}

 

action my_entity

{

  my.enable_touch = on;

  my.enable_release = on;

  my.event = touched_by_pointer;

}

 

function touched_by_pointer()

{

  if (event_type == event_touch) // touched by the mouse

  {

     my.skill40 = 1; // set this skill

  }

  if (event_type == event_release) // the mouse was moved away from the entity?

  {

     my.skill40 = 0; // reset this skill

  }

  while (my.skill40 == 1) // as long as the mouse wasn't moved away from the entity

  {

     if (key_space == on) // "space" was pressed?

     {

        my.ambient = 100; // put the code that does what you want here

     }

     wait (1);

  }

  my.ambient = 0; // the mouse was moved away here

}

 

 

Q: How can I create a sky that uses a sprite and the "cylinder" flag?

A: Use this example:

 

sky my_panorama

{

   type = <skysprite.pcx>;

   layer = 30;

   tilt = -50;

   flags = scene, cylinder, overlay, visible;

}

 
aum49_questions2

 

 

Q: I have captured video inside one of my games and I edited it with Windows Movie Maker, adding some cool effects to it. How can I take that file and use it in my game?

A: Use the example below; it starts playing the movie as soon as the player approaches the entity that has this action attached to it:

 

action movie_trigger

{

   // my invisible = on; // remove the comment after you set a proper position for the entity

   while (player == null) {wait (1);}

   while (vec_dist(player.x, my.x) > 100) {wait (1);} // wait until the player has come closer than 100 quants to the entity

   media_play("volcano.wmv", null, 80); // replace volcano.wmv with your own wmv file

   ent_remove (my);

}

 

 

Q: Is it possible to make a quiz with A6?

A: Sure.

 

bmap beverages_pcx = <beverages.pcx>;

bmap water1_pcx = <water1.pcx>;

bmap water2_pcx = <water2.pcx>;

bmap milk1_pcx = <milk1.pcx>;

bmap milk2_pcx = <milk2.pcx>;

bmap soda1_pcx = <soda1.pcx>;

bmap soda2_pcx = <soda2.pcx>;

 

function check_beverages(button_number);

 

text drinks_txt

{

  layer = 25;

  pos_x = 200;

  pos_y = 450;

  font = _a4font;

  flags = visible;

}

 

panel beverages_pan

{

  bmap = beverages_pcx;

  pos_x = 100;

  pos_y = 100;

  layer = 15;

  button = 50, 150, water2_pcx, water1_pcx, water2_pcx, check_beverages, null, null;

  button = 50, 200, milk2_pcx, milk1_pcx, milk2_pcx, check_beverages, null, null;

  button = 50, 250, soda2_pcx, soda1_pcx, soda2_pcx, check_beverages, null, null;

  flags = overlay, refresh, visible;

}

 

function check_beverages(button_number)

{

  beverages_pan.visible = off;

  if (button_number == 1) // water?

  {

     drinks_txt.string = "You have chosen water! Good for you!";

  }

  if (button_number == 2) // milk?

  {

     drinks_txt.string = "Milk? That's a healty beverage!";

  }

  if (button_number == 3) // soda?

  {

     drinks_txt.string = "Soda? Why do you like to drink sodas?";

  }

}

 

 

Q: How can I get the closest vertex to the point where I have shot an enemy?

A: Use this example:

 

var closest_vertex;

 

panel test_pan

{

  digits = 5, 15, 6, _a4font, 1, closest_vertex;

  flags = overlay, refresh, visible;

}

 

starter traced_vertex()

{

  var trace_coords;

  while (1)

  {

     if (key_space == 1)

     {

        while (key_space == 1) {wait (1);}

        vec_set(trace_coords.x, vector(1000, 0, 0)); // trace 1000 quants in front of the camera (the player)

        vec_rotate(trace_coords.x, camera.pan); // rotate "temp" in the direction (angles) given by the camera (the player)

        vec_add(trace_coords.x, camera.x); // add the resulting vector to camera's (player's) position

        result = c_trace (camera.x, trace_coords.x, ignore_me | ignore_passable | get_hitvertex);

        if ((result > 0) && (you != null)) // hit an entity?

        {

           closest_vertex = hitvertex;

        }

     }

     wait (1);

  }

}