--New feature: Camera Zooming; You can now have the camera zoom in and out according to how far the targets are. More details on this will be provided in the next log together with the new Stage tags.
--You can finally have comments in the "{info}{/info}" part of the .A file. And you can now put arithmetic expressions as parameters for the tags there, and they will be evaluated.
--New 2 in-file tags (in-file tags are an enclosing pair where instructions inside are only run at specific conditions. These are usually placed at the beginning of the .A files.):
-{main_loop}{/main_loop}: Instructions found inside the pair will be run every 1/FPSth of a second; every frame.
Code:
{info} #in_file "info" tag
ALLOCATE_FRAMES=1000 #1000 frames are allocated
ALLOCATE_IMGS=15 # 15 images can be loaded
ALLOCATE_SNDS=20 # 20 sounds can be loaded
NAME= Luffy
MAXPTS_HP_SP_RP= 500,500,500
INITPTS_HP_SP_RP= 500, 500, 500
WALKSPD_X_Z= 2, 1
...etc ..etc
{/info}
{main_loop}
add_rp=1-(@currhp@/@maxhp@) #rp will be regenerated every frame
set_reg=$t$, $t$+1 #the register $t$ will be incremented every frame (this can be made to a timer)
set_reg=$t$, ~$t$>60?0:$t$; #if $t$ is greater than 60, it is set back to 0. Else, it is just assigned to itself.
add_sp=1.5 #1.5 stamina pts are regenerated every frame
{/main_loop}
# Frames go here
[f=0]
img=1 center=0,0 delay=3 goto=1
[/f]
[f=1]
img=2 center=0,0 delay=3 goto=2
[/f]
#etcetc
The only supported tags/instruction in the main_loop tag are:
"set_reg=x,y" sets the register x the value y.
"add_hp=x" adds up the object's health pts by x
"add_sp=x" adds up the object's stamina pts by x
"add_rp=x" adds up the object's rage pts by x
"add_bp=x" adds up the object's bonus pts by x (an extra bar I put just if someone ever needs it)
"add_dp=x" adds up the object's defense pts by x
"add_kp=x" adds up the object's knock pts by x
-{init_regs}{/init_regs}: "set_reg=" instructions found inside the tag will only be run when the object is first called.
Code:
{info}
etc.. etc
{/info}
{main_loop}
etc.. etc
{/main_loop}
{init_regs}
set_reg=$a$, 1000
set_reg=$q$, 500
{/init_regs}
# Frames go here
[f=0]
img=1 center=0,0 delay=3 goto=1
[/f]
[f=1]
img=2 center=0,0 delay=3 goto=2
[/f]
#etc etc
The only supported tag/instruction here is "set_reg=". We all know that register's initial value are set to 0. In some cases, you would like to change that. This in-file tag was made to help you do that.
--[snd][/snd] info tag (found within the {info}{/info} in-file tag): Loads sound files and assign them an id.
Code:
{info}
NAME=Character
ALLOCATE_IMGS=2 #prepare memory for 2 image files to be loaded.
ALLOCATE_SNDS=2 #prepare memory for 2 sound files to be loaded.
..etc..etc
[img]
sprite\sys\character0.png, 79, 79, 10, 7, 0x000000 #0-69
sprite\sys\character1.png, 79, 79, 10, 7, 0x000000 #70-139
[/img]
[snd]
data\sound\sound0.wav #id 0
data\sound\sound1.wav #id 1
[/snd]
{/info}
It's only parameter is the directory. Ids will be give according to the order they were loaded just like the info tag. To play the sounds, you are going to use the frame component, call_sound[], to play them in your frames.
--New 3 frame-components (frame-components are enclosed blocks of related tags which adds or sets some feature to the frame):
-set_transformation[]: A component which lets you do transformations on the frame's texture/image. You can rotate, reflect, stretch or shear your sprites at will. Put in mind that collision-detection related frame-components can not undergo any of the transformations together with the texture/image (at least not yet).
Code:
[f=0] #example frame
set_transformation[
center=0,0
x_scale_factor=2 y_scale_factor=1
rotation_angle=90
x_shear_factor=1 y_shear_factor=0
x_translate_vector=-30 y_translate_vector=-10
delay=0 set_reg=$a$, 1 condition=@hp@<200
]
[/f]
"center=" the coordinates of the center of transformation.
"x_scale_factor=", "y_scale_factor=" sets the x and the y stretch values for the image texture.
"rotation_angle=" is the angle you would like to rotate.
"x_shear_factor=", "y_shear_factor=" the x and the y factors for a shearing operation.
"x_translate_vector=", "y_translate_vector=" change the position of your texture/image without affecting its in-game position. The parameters are the x and the y values you would like to translate your image by.
"delay=", "set_reg=", "condition=" works just like with every frame-component.
e.g:
>> rotation_angle=45 >>
(note the size changed due to camera zooming there)
Related switches:
|REFLECTX| =>When this switch is there, your texture/image is reflected parallel to the y-axis on the center.
|REFLECTY| =>When this switch is there, your texture/image is reflected parallel to the x-axis on the center.
Uses:
.You no longer have to create new sprites for when you want to rotate a sprite.
.Chasing energy blasts in the y axis can be made to actually rotate facing the target!!
.Scaling can prove really useful if you plan to have giant characters in your game. Imagine having to load assets for a giant character 400 px high and 350 px wide! You would want to preserve the quality of the animations and all, but it would take a looot of time and memory to load sheets that big. Now you can sprite your giant in a smaller size and then simply scale him up in the game! The Engine's OpenGL linear filtering insures the least amount of pixelation once it has been scaled!
.Falling momentum show in sprites: You can use the rotation feature to rotate the falling sprites according to how fast and the velocity of their object. This is so cool, and we are totally gonna have this for OPAE. NEXT GEN!
-set_set_dirtyquad[]: A component which lets you further clip an area or a quad off a sprite. Only the area enclosed by this quad will be rendered on the screen.
Code:
[f=0] #example frame
set_dirtyquad[
top_left_vertex=0,0 top_right_vertex=10, 50 bottom_right_vertex=70,40 bottom_left_vertex=5, 22
delay= set_reg= condition= #same old
]
[/f]
"top_left_vertex=", "top_right_vertex=", "bottom_right_vertex=", "bottom_left_vertex=" the vertices of the dirty quad.
"delay=", "set_reg=", "condition=" works just like with every frame-component.
e.g:
>> set_dirtyquad[]
>>
Uses:
.Imagine a case where you're having sort of small sprites, and its overdoing to have a complete sheet reserved for these or even place them in too-big squares which is just a plain waste. These all together would fit into one of the squares in the bigger gird; why not place them there and then clip each down with dirty quads in the game to make each appear alone?
-call_sound[]: A component to play sounds.
Code:
[f=0] #example frame
call_sound[
id=0 repeat=0 volume=100
delay=0 set_reg=$a$, 1 condition=@hp@<200
]
[/f]
"id=" the id of the sound loaded at the {info}{/info} part; works pretty much like the in-frame "img=" tag.
"repeat=" how many times should that sound repeat after it has played once.
"volume=" set how loud the sound is going to be. Max being 120 and mute being 0.
--New: 3 in-file switches (switches which affects your whole object altogether. Despite the name which suggests they're to be placed anywhere in the .a file, outside any tag, I've decided to let them be inside the {info}{/info} tag to make stuff more organized):
Code:
{info}
|NOSHADOW|NOBARS|IGNOREGRAVITY|
NAME=ABCD
ALLOCATE_IMGS=10
..etc
{/info}
The |NOSHADOW| switch will have all the frames in your object contain no shadow. Once you use that, you won't have to use |NOSHADOW| specifically for every frame to have the object shadowless. That's not the only advantage however; using that will make the engine not create a "shadow sheet" (a duplicate version of the sheet where all the visible colors are set to white and further filtered to form the shadows). This decreases the loading time and the memory usage of the game for that object.
The |NOBARS| switch will automatically disable bars for the whole object, so you wouldn't have to use it individually with every frame. This switch used like that will have the object not allocate 4 other objects that resembles the bars (HP, SP, RP and BP(bonus pts)).
The |IGNOREGRAVITY| switch will have your object unaffected by gravitational acceleration, again, without having to specify that switch with every frame.
--Bars now make use of frames; in other words, you can control how your bars look or even animate them just as if they were objects. This needs going in detail with some special .a file, "system.a", and I am already tired of typing.. Will explain everything later :P.