Use a gosub command when working with sprites instead of a function command. Here is my subimages information. (I got these from Cliff so Cliff deserves the credit.)
Here is the code in main
#include walls2_subimages.agc
GOSUB Setup_Atlas
Here is the walls2_subimages.agc. Your subimages.txt must have the same same as your .png file.
Setup_Atlas:
Atlas_IMG = LoadImage ( "walls2.png" )
SetImageMagFilter( Atlas_IMG, 1 )
SetImageMinFilter( Atlas_IMG, 1 )
global wall1
wall1 = LoadSubImage ( Atlas_IMG, "wall1.png" )
global wall2
wall2 = LoadSubImage ( Atlas_IMG, "wall2.png" )
global wall3
wall3 = LoadSubImage ( Atlas_IMG, "wall3.png" )
global wall4
wall4 = LoadSubImage ( Atlas_IMG, "wall4.png" )
global wall5
wall5 = LoadSubImage ( Atlas_IMG, "wall5.png" )
global wall6
wall6 = LoadSubImage ( Atlas_IMG, "wall6.png" )
global wall7
wall7 = LoadSubImage ( Atlas_IMG, "wall7.png" )
global wall8
wall8 = LoadSubImage ( Atlas_IMG, "wall8.png" )
global wall9
wall9 = LoadSubImage ( Atlas_IMG, "wall9.png" )
global wall10
wall10 = LoadSubImage ( Atlas_IMG, "wall10.png" )
global wall11
wall11 = LoadSubImage ( Atlas_IMG, "wall11.png" )
global wall12
wall12 = LoadSubImage ( Atlas_IMG, "wall12.png" )
global wall13
wall13 = LoadSubImage ( Atlas_IMG, "wall13.png" )
global wall14
wall14 = LoadSubImage ( Atlas_IMG, "wall14.png" )
global wall15
wall15 = LoadSubImage ( Atlas_IMG, "wall15.png" )
global wall16
wall16 = LoadSubImage ( Atlas_IMG, "wall16.png" )
global wall17
wall17 = LoadSubImage ( Atlas_IMG, "wall17.png" )
global wall18
wall18 = LoadSubImage ( Atlas_IMG, "wall18.png" )
global door1
door1 = LoadSubImage ( Atlas_IMG, "door1.png" )
global door2
door2 = LoadSubImage ( Atlas_IMG, "door2.png" )
global door3
door3 = LoadSubImage ( Atlas_IMG, "door3.png" )
global door4
door4 = LoadSubImage ( Atlas_IMG, "door4.png" )
global door5
door5 = LoadSubImage ( Atlas_IMG, "door5.png" )
global door6
door6 = LoadSubImage ( Atlas_IMG, "door6.png" )
global door7
door7 = LoadSubImage ( Atlas_IMG, "door7.png" )
global door8
door8 = LoadSubImage ( Atlas_IMG, "door8.png" )
global door9
door9 = LoadSubImage ( Atlas_IMG, "door9.png" )
global floor1
floor1 = LoadSubImage ( Atlas_IMG, "floor1.png" )
global floor2
floor2 = LoadSubImage ( Atlas_IMG, "floor2.png" )
return
Here is the walls2 subimages.txt (the name of the file is walls2 subimages.txt that is because my .png is walls2.png. If you change that to your own .png file make sure you change the subimages.txt name to reflect that.
wall1.png:0:0:128:96
wall2.png:128:0:128:192
wall3.png:256:0:128:192
wall4.png:384:0:96:96
wall5.png:0:96:128:96
wall6.png:128:192:128:192
wall7.png:256:192:128:192
wall8.png:384:96:92:138
wall9.png:0:288:128:192
wall10.png:0:192:128:96
wall11.png:384:256:92:138
wall12.png:128:416:96:96
wall13.png:224:416:64:96
wall14.png:288:416:64:96
wall15.png:352:416:64:96
wall16.png:384:512:96:160
wall17.png:384:672:96:160
wall18.png:384:832:96:96
door1.png:0:512:128:192
door2.png:128:512:128:192
door3.png:256:512:128:192
door4.png:0:704:128:192
door5.png:128:704:128:192
door6.png:256:704:128:192
door7.png:0:928:128:96
door8.png:128:928:128:96
door9.png:256:928:128:96
floor1.png:416:416:64:48
floor2.png:416:464:64:48