What is wrong with this code? I have checked everything I can think of.
So far, the problem is fixed by:
1. Not calling the "gosub freesprites" command. This results in overlapping sprites that mess everything up.
2. Not calling the "sync on" command at the beginning. This results in an extremely slow loading process making it a terrible program that is not worth the time it takes to make.
here is the code
(the dimensions for the "bodies" files are 288x256)
(the dimensions for the "cursor" file is 24x44)
remstart
Character Set generator
For use with RPG Maker 2000 and RPG Maker 2003
Created By: The Newbie
remend
hide mouse
load image "cursor.bmp",65535
sync on
x=0
y=0
x2=23
y2=31
imagenum=13
set=2
gosub images
gosub setup
gosub loadmid
gosub loops
end
images:
`char type images
load image "button 1.bmp",1
load image "button 2.bmp",2
load image "button 3.bmp",3
load image "button 4.bmp",4
`char parts images
load image "body button.bmp",5
load image "head button.bmp",6
load image "hair button.bmp",7
load image "shirt button.bmp",8
load image "pants button.bmp",9
load image "item 1.bmp",10
load image "item 2.bmp",11
load image "item 3.bmp",12
return
getimages:
sync on
for u=1 to 2
for c=1 to 10
for o=1 to 4
for i=1 to 3
get image imagenum,x,y,x2,y2
x=x+24
x2=x2+24
imagenum=imagenum+1
next i
y=y+32
y2=y2+32
x=x-72
x2=x2-72
next o
x=x+24
x2=x2+24
y=y-128
y2=y2-128
next c
y=128
y2=159
x=0
x2=23
next u
return
freesprites:
for i=13 to imagenum-1
delete sprite i
sleep 100
next i
return
setup:
sprite 1,50,100,1
sprite 2,50,125,2
sprite 3,50,150,3
sprite 4,50,175,4
sprite 5,500,100,5
sprite 6,500,125,6
sprite 7,500,150,7
sprite 8,500,175,8
sprite 9,500,200,9
sprite 10,500,225,10
sprite 11,500,250,11
sprite 12,500,275,12
return
loadfight:
gosub fight
sprite 13,225,100,20
sprite 14,250,100,45
sprite 15,275,100,81
sprite 16,300,100,117
sprite 17,325,100,140
sprite 18,350,100,165
sprite 19,375,100,201
sprite 20,400,100,237
sprite 21,425,100,260
sprite 22,450,100,285
sprite 23,475,100,321
sprite 24,200,131,357
imagenum=25
return
loadmid:
gosub Mid
sprite 13,225,100,20
sprite 14,250,100,45
sprite 15,275,100,81
sprite 16,300,100,117
sprite 17,325,100,140
sprite 18,350,100,165
sprite 19,375,100,201
sprite 20,400,100,237
sprite 21,425,100,260
sprite 22,450,100,285
sprite 23,475,100,321
sprite 24,200,131,357
sprite 25,225,131,380
sprite 26,250,131,416
sprite 27,275,131,452
sprite 28,300,131,488
sprite 29,325,131,500
sprite 30,350,131,536
imagenum=31
return
loadtall:
gosub tall
sprite 13,225,100,20
sprite 14,250,100,45
sprite 15,275,100,81
imagenum=16
return
loadteddy:
gosub teddy
sprite 13,225,100,20
imagenum=14
return
`char images
Mid:
load bitmap "Mid\Bodies\bodies 1-8b.bmp",1
gosub getimages
x=0
y=0
x2=23
y2=31
load bitmap "Mid\Bodies\bodies 9-16b.bmp",1
gosub getimages
x=0
y=0
x2=23
y2=31
load bitmap "Mid\Bodies\bodies 17-18b.bmp",1
gosub getimages
return
fight:
load bitmap "Fighter-Soldiers\Bodies\bodies 1-8.bmp",1
gosub getimages
`wait key
x=0
y=0
x2=23
y2=31
load bitmap "Fighter-Soldiers\Bodies\bodies 9-12.bmp",1
gosub getimages
return
tall:
load bitmap "Tall\Bodies\bodies 1-3b.bmp",1
gosub getimages
return
teddy:
load bitmap "Teddy\Bodies\bodies 1-1b.bmp",1
gosub getimages
return
loops:
sync off
do
sprite 300,mousex(),mousey(),65535
if mouseclick()=1
if sprite collision(300,1)
repeat
until mouseclick()=0
gosub freesprites
gosub loadfight
sync off
endif
endif
loop
return