Advertisement
Mr-A

A-Engine Stage Code Design

Oct 12th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #A-Engine @ http://www.a-superlab.com/category/a-engine/
  2.  
  3. # {info} {/info} header of stage files
  4. # BG_MUSIC_ID= music id to play in this stage. a value of NONE is used to have no music. a value of -1 is used to let previous music play in the stage
  5. # StAGE_LENGTH = is the length of the area for the stage
  6. # STAGE_WIDTH= is the width of the area for the stage
  7. # STAGE_HEIGHT= is the height of the area for the stage
  8. # CLEAR_COLOR = the color shown where there is no entity rendered in red, green, blue format
  9.  
  10. # in between [img][/img] are sprites and textures loaded which can be rendered for an entity via the "img=" tag
  11. # in between [mdl][/mdl] are 3D models loaded which can be rendered for an entity via the "mdl=" tag
  12. # in between [cam][/cam] are camera objects which captures a view in the stage which you can use to render somewhere. by default a camera with id=0 will have what it sees rendered to the screen
  13.  
  14. {info}
  15.   BG_MUSIC_ID = 1;
  16.   STAGE_LENGTH = 1000;
  17.   STAGE_WIDTH = 1000;
  18.   STAGE_HEIGHT = 1000;
  19.   CLEAR_COLOR = 128, 128, 255; # sky blue
  20.  
  21.   [img]
  22.     tile[dir = "bg1/tiles/ground.png"] #0
  23.     tile[dir = "bg1/tiles/sky.png"] #1
  24.     sheet[dir="bg1/clouds.png" w=200 h=100 col=2 row=1] #2
  25.   [/img]
  26.  
  27.   [mdl]
  28.     obj[dir = "bg1/objects/tree_model.obj" scale = 200]
  29.   [/mdl]
  30.  
  31.   [cam]
  32.    cam[ |PERSPECTIVE| # perspective projection switch
  33.    # id for objects to access the camera
  34.     id = 0 # 0 is the default camera which view's rendered to screen
  35.  
  36.    # initial camera orientation
  37.     eye_position = 30, 30, 30
  38.     look_at = 30, 30, 100
  39.     top_direction = 0, 1, 0
  40.    
  41.    # other settings
  42.     min_target_range = 100 # distance to keep from the target position
  43.     x_fov = 60 # field of view
  44.     near = 10
  45.     far = 1000
  46.  
  47.    # camera movement in space
  48.     eye_weight = 20 # how 'heavy' the eye is. the more this is, the slower the camera will follow
  49.     lookat_weight = 15 # the more this is, the slower the lookat vector will change
  50.    ]
  51.   [/cam]
  52.  
  53.  
  54. {/info}
  55.  
  56. # a light source which is responsible for lighting and the position of shadows
  57. # will be explained later in detail
  58. [directional_light] # yellowish sun light
  59.   position = 0, 1000, 0 ambient_color=120,120,120 diffuse_color=180,180,180 specular_color=255,255,255 direction_vector=1,-1,0 #down-right direction
  60. [/directional_light]
  61.  
  62. # "x_repeat=no." and "y_repeat=no." are tags only available for use when "img=" points to a "tile"
  63. # it repeats the tile by a no. of times in the x and the y axes respectively
  64. [entity] # ground
  65.   img = 0 position = -10,0,-20  x_repeat = 50 y_repeat = 50
  66.   # there is actually no need to rotate this, because 'tiles' are oriented 90 degs by default
  67. [/entity]
  68.  
  69. [entity] # sky
  70.   img = 1 position = -10,-2000,-50  x_repeat = 50 y_repeat = 50 x_parallax_factor=0 y_parallax_factor=0 z_parallax_factor=0 #won't move with the camera
  71.   set_transformation[rotate_angle=-90 rotate_vector=1,0,0] # rotate to have the sky tiles face the screen
  72. [/entity]
  73.  
  74. # x,y,z_recreation_range will cause an object to be created every x, y or z unit length interval
  75. # a new tree will be spawned every 500 unit length in the x-axis
  76. # max_entities= limits the amount of entities that can be created by x,y,z_recreation_range
  77. # 10 trees which appears in random positions in the stage
  78. [entity] # trees
  79.   mdl = 0 position = 10, 0, -200  z_offset = &random{-50, 50} x_offset = &random{-50, 50} x_recreation_range = 500 max_entities = 10
  80.   set_transformation[rotate_angle=&random{0, 360} rotate_vector=0,1,0]
  81. [/entity]
  82.  
  83. # 3 clouds at a time, once they pass the screen, a new one comes from teh side
  84. [entity] # clouds
  85.   img = &random{0,1},2 position = -100,500,-1 y_offset=&random{-60, 60} x_offset=&random{-40, 40} x_parallax_factor=0.2 y_parallax_factor = 0.1 z_parallax_factor=0.07
  86.   x_recreation_interval=400  max_entities = 3 x_vel=10 restart_x_position_distance=1200
  87. [/entity]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement