maxman
Well-known member
Simple. You need to add the given names with globalvars in both oncreate() and ondestroy() for both title and select screens. Also, if you want to give names of images in specific path/place, you need to use loadsprite(path). (Sprite count.)
Example in update.c:
In updated.c. Make one function for displaying the sprites in title like this.
Make the other one for select screen like this.
You can add names select and title in function main.
Example in updated.c:
Example in update.c:
Code:
void main()
{ //Update script
}
void oncreate()
{
void title01; void title02; void title03; void title04; void title05;
void sel01; void sel02; void sel03; void sel04; void sel05; void sel06; void sel07;
title01 = loadsprite("data/bgs/title1.png");
title02 = loadsprite("data/bgs/title2.png");
title03 = loadsprite("data/bgs/title3.png");
title04 = loadsprite("data/bgs/title4.png");
title05 = loadsprite("data/bgs/title5.png");
sel01 = loadsprite("data/bgs/select01.png");
sel02 = loadsprite("data/bgs/select02.png");
sel03 = loadsprite("data/bgs/select03.png");
sel04 = loadsprite("data/bgs/select04.png");
sel05 = loadsprite("data/bgs/select05.png");
sel06 = loadsprite("data/bgs/select06.png");
sel07 = loadsprite("data/bgs/select07.png");
setglobalvar("title01", title01);
setglobalvar("title02", title02);
setglobalvar("title03", title03);
setglobalvar("title04", title04);
setglobalvar("title05", title05);
setglobalvar("sel01", sel01);
setglobalvar("sel02", sel02);
setglobalvar("sel03", sel03);
setglobalvar("sel04", sel04);
setglobalvar("sel05", sel05);
setglobalvar("sel06", sel06);
setglobalvar("sel07", sel07);
}
void ondestroy()
{
void title01 = getglobalvar("title01");
void title02 = getglobalvar("title02");
void title03 = getglobalvar("title03");
void title04 = getglobalvar("title04");
void title05 = getglobalvar("title05");
void sel01 = getglobalvar("sel01");
void sel02 = getglobalvar("sel02");
void sel03 = getglobalvar("sel03");
void sel04 = getglobalvar("sel04");
void sel05 = getglobalvar("sel05");
void sel06 = getglobalvar("sel06");
void sel07 = getglobalvar("sel07");
free(title01);
free(title02);
free(title03);
free(title04);
free(title05);
free(sel01);
free(sel02);
free(sel03);
free(sel04);
free(sel05);
free(sel06);
free(sel07);
setglobalvar("title01", NULL());
setglobalvar("title02", NULL());
setglobalvar("title03", NULL());
setglobalvar("title04", NULL());
setglobalvar("title05", NULL());
setglobalvar("sel01", NULL());
setglobalvar("sel02", NULL());
setglobalvar("sel03", NULL());
setglobalvar("sel04", NULL());
setglobalvar("sel05", NULL());
setglobalvar("sel06", NULL());
setglobalvar("sel07", NULL());
}
In updated.c. Make one function for displaying the sprites in title like this.
Code:
if(openborvariant("in_menuscreen")==1 || openborvariant("in_titlescreen")==1){
Make the other one for select screen like this.
Code:
if(openborvariant("in_selectscreen")){
You can add names select and title in function main.
Example in updated.c:
Code:
void main(){
titleScreen();
selectScreen();
}
void titleScreen(){
if(openborvariant("in_menuscreen")==1 || openborvariant("in_titlescreen")==1){
int TC = getglobalvar("TC");
int Time = getglobalvar("Time");
void title01 = getglobalvar("title01");
void title02 = getglobalvar("title02");
void title03 = getglobalvar("title03");
void title04 = getglobalvar("title04");
void title05 = getglobalvar("title05");
void Gambar;
if(Time == NULL() || Time >= 24){ // 12 centiseconds
Time = 0;
if(TC == NULL() || TC > 8){
TC = 1;
}
if(TC == 1){
Gambar = title01;
} else if(TC == 2){
Gambar = title02;
} else if(TC == 3){
Gambar = title0;
} else if(TC == 4){
Gambar = title0;
} else if(TC == 5){
Gambar = title05;
}
setglobalvar("TC", TC + 1);
}
drawsprite(Gambar, 0, 0, -2500);
setglobalvar("Time", Time+1);
}
}
void selectScreen(){
if(openborvariant("in_selectscreen")){
int TC = getglobalvar("TC");
int Time = getglobalvar("Time");
void sel01 = getglobalvar("sel01");
void sel02 = getglobalvar("sel02");
void sel03 = getglobalvar("sel03");
void sel04 = getglobalvar("sel04");
void sel05 = getglobalvar("sel05");
void sel06 = getglobalvar("sel06");
void sel07 = getglobalvar("sel07");
void BGFlash;
if(Time == NULL() || Time >= 24){
Time = 0;
if(TC == NULL() || TC > 9){
TC = 1;
}
if(TC == 1){
BGFlash = sel01;
}else if(TC == 2){
BGFlash = sel02;
}else if(TC == 3){
BGFlash = sel03;
}else if(TC == 4){
BGFlash = sel04;
}else if(TC == 5){
BGFlash = sel05;
}else if(TC == 6){
BGFlash = sel06;
}else if(TC == 7){
BGFlash = sel07;
}
setglobalvar("TC", TC + 1);
}
drawsprite(BGFlash, 0, 0, -2500);
setglobalvar("Time", Time+1);
}
}