Hi
Thank you for your answer.
I have modified my code (with all your remarks
), but I still have errors or crash...
I don't understand why, is the trial version stable enough to test ?
My new code is :
main.agc
//***************************************
// INCLUDE
//***************************************
// resolution, intro...
#include "infos.agc"
#include "structures.agc"
#include "global.agc"
// library (image, sprite...)
#include "lib.agc"
//***************************************
// IMAGES - SPRITE
//***************************************
AddImageUi ( )
// Mob
for i = 1 to 5
g_Mob[ i ].iSprite = CreateSprite ( 100 )
g_Mob[ i ].life = 10
g_Mob[ i ].speed = 3
g_Mob[ i ].degat = 1
g_Mob[ i ].x = -100 - 100 * i
g_Mob[ i ].y = -100
SetSpritePosition ( g_Mob[ i ].iSprite, -100 - 100 * i, -100 )
next i
//***************************************
// THE MAIN LOOP
//***************************************
do
sync ( )
loop
infos.agc
//***************************************
// RESOLUTION
//***************************************
//SetOrientationAllowed ( 0, 0, 1, 1 )
SetVirtualResolution ( g_width, g_height )
SetResolutionMode ( 1 )
structures.agc
//***************************************
// STRUCTURES
//***************************************
// Monster
Type sMonter
x as integer
y as integer
iSprite as integer
life as integer
speed as integer
degat as integer
EndType
// path
Type sPath
x as integer
y as integer
EndType
global.agc
// width and hieght of the device
global g_width
global g_height
g_width = GetDeviceWidth ( )
g_height = GetDeviceHeight ( )
global xx, yy, w, h, zoom
Zoom = 1
// monsters
global dim g_Mob[ 5 ] as sMonter
// the path of the monster
global dim g_Path[ 8 ] as sPath
lib.agc
function AddImageUi ( )
// Decors
// load the map (background)
LoadImage ( 1, "map01.jpg" )
CreateSprite ( 1, 1 )
// Btn Menus for towers
LoadImage ( 4, "btn.png" )
for i = 0 to 3
CreateSprite ( 4 + i, 4 )
FixSpriteToScreen ( 4 + i, 1 )
SetSpriteShape ( 4 + i, 3 )
SetSpritePosition ( 4 + i, 64 * i + 2, 0 )
next i
// the money UI
loadimage ( 5, "money.png" )
CreateSprite ( 5, 5 )
FixSpriteToScreen ( 5, 1 )
SetSpriteShape ( 5, 3 )
i = g_width - 100
SetSpritePosition ( 5, i, 0 )
// Monsters
LoadImage ( 100, "mob01.png" )
endfunction