[DEMO] Animated Title and Base mod

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:

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);
	}
}
 
Thanks ...but didnt work for me...idont know what i did wrong...i have some dificults with scripts... :-[
 
@kdo: if you use same animation in title, menu and select screen, you can replace this line:

Code:
   if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen")){

to this:

Code:
   if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen") || openborvariant("in_selectscreen")){

however if you use different animation for each, you'll need to load more images

@maxman: That's strange, I've tried this and it works
 
I just corrected my post to show how to add both title and select together in updated.c. Thought you'd figure out after Bloodbane posted, but then I changed it. Couldn't explain it with words, but code examples.

@Bloodbane: I know it works but it's strange to me it doesn't show.
 
Thanks guys...i'll try this... i need 2 diferents animations, one in title/menu screen and another in select screen....or use the same animation of title screen, but with a new image layer static above the animation.
I'll try this ones you shared....thanks...
 
Replace the line to show the same animation works perfect... Thanks Bloodbane.
But now i need to understand how to use diferent animations for menu screen, title screen and select screen....or even any other screen.
Its so cool and gives a better look to the mod....thanks guys....
 
Okay, I've updated updated.c to have different animation for title screen and for select screen.
I'll post this on first page so please read that page :)
 
THANK YOU SO MUCH!!!! @Bloodbane...you are my HERO...this update works perfect ...even in a old openbor engine...Thanks for the suport...
Just one more question, can we run animated gif as back ground with this script ? just not need to load a lot of images...
 
@kdo i have made an alternative mode to to this, check the topic http://www.chronocrash.com/forum/index.php?topic=3137.0

Instead images, I use entities for that, so its easier to control time and even sounds.
 
Wow!!! Thanks to share this @O ilusionista ( valeu mano...rsss) i'll take a look, i hope it works with old version engines...thanks bro!
 
kdo said:
Just one more question, can we run animated gif as back ground with this script ? just not need to load a lot of images...

No. You need different function and script system for that.
 
kdo said:
Wow!!! Thanks to share this @O ilusionista ( valeu mano...rsss) i'll take a look, i hope it works with old version engines...thanks bro!

É nois na fita :)
sadly my script works only from a specific version and beyond.
 
Bloodbane, what does 0 at scrollpos (at) under scrollx mean, along the enemies and items spawned? I see some entities spawn at different scrollpos (at) besides 0. Why the ats 0?

Code:
scrollx	900 3000
at	0

spawn	Rover
coords	400 220
at	1250

spawn	Carol
map	3
coords	400 170
at	0

spawn	Drum
health  10
flip    1
item	apple
coords	400 240
at	1300

spawn	Drum
health  10
flip    1
item	apple
coords	400 170
at	1400


spawn	Rini
coords	400 240
at	1450

spawn	Rover
map	1
coords	-100 160
at	0


scrollx	1400 1500
at	1500

group	3 3
at	0

spawn	Ray
map	2
coords	400 190
at	0

spawn	Ray
map	1
coords	-80 220
at	0

spawn	Topan
coords	-80 170
at	0

spawn	Rini
map	2
coords	400 210
at	0

spawn	Rini
map	1
coords	-80 190
at	0

spawn	Topan
coords	-80 210
at	0

group	1 1
at	0

group	100 100
at	0
 
Setting scrollpos to 0 is simple and quick way to order spawns in a level.

Code:
group	100 100
at	0

means grouping is set to 100 100 when this line is run right away (regardless of current scroll position)
Also, these two settings work the same:

Code:
scrollx	900 1000
at	1000

group	1 1
at	1000

and

Code:
scrollx	900 1000
at	1000

group	1 1
at	0

The former is more clear but less flexible. The latter is less clear but more flexible i.e if I want to change at, I only need to change one at instead of all related ats
 
Thanks dantedevil  ;D

With this method is it possible to use alpha 1 in the images?

I assume you're referring to animated title images?

If yes, then the answer is yes  :).

A simple change is needed to apply alpha to those images.
You need to open updated.c to find a line with drawsprite function and change it into something like this:
Code:
 void Image;
      Image = drawsprite(Gambar, 0, 0, -2500);
      setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);
 
Bloodbane said:
Thanks dantedevil  ;D

With this method is it possible to use alpha 1 in the images?

I assume you're referring to animated title images?

If yes, then the answer is yes  :).

A simple change is needed to apply alpha to those images.
You need to open updated.c to find a line with drawsprite function and change it into something like this:
Code:
 void Image;
      Image = drawsprite(Gambar, 0, 0, -2500);
      setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);

That's great friend!

But where should I add this:
Code:
void Image;
      Image = drawsprite(Gambar, 0, 0, -2500);
      setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);


Do I have to modify the two there are?
The one at the beginning and at the end, how you mark them in your script.
void main(){
    if(openborvariant("in_menuscreen")==1 || openborvariant("in_titlescreen")==1){
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void Gambar;

      if(!Gambar){
        Gambar = getglobalvar("Jud1");
      }

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 4){
          TC = 1;
        }

        if(TC == 1){
          Gambar = getglobalvar("Jud1");
        } else if(TC == 2){
          Gambar = getglobalvar("Jud3");
        } else if(TC == 3){
          Gambar = getglobalvar("Jud5");
        } else if(TC == 4){
          Gambar = getglobalvar("Jud7");
        }
        setglobalvar("TC", TC + 1);
      }

      drawsprite(Gambar, 0, 0, -2500);
      setglobalvar("Time", Time+1);
    } else if(openborvariant("in_selectscreen")){
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void Gambar;

      if(!Gambar){
        Gambar = getglobalvar("Jud2");
      }

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 4){
          TC = 1;
        }

        if(TC == 1){
          Gambar = getglobalvar("Jud2");
        } else if(TC == 2){
          Gambar = getglobalvar("Jud4");
        } else if(TC == 3){
          Gambar = getglobalvar("Jud6");
        } else if(TC == 4){
          Gambar = getglobalvar("Jud8");
        }
        setglobalvar("TC", TC + 1);
      }

      drawsprite(Gambar, 0, 0, -2500);
      setglobalvar("Time", Time+1);
    }
}
 
Bloodbane I've done a lot of testing and got the original script to work for me, but I can't get this to work for the "alpha1" transparency to work for me.
Code:
void Image;
      Image = drawsprite(Gambar, 0, 0, -2500);
      setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);

Here my script:
Code:
void main(){

   processRushCount();

    if(openborvariant("in_titlescreen")==0 || openborvariant("in_menuscreen")==1){
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void wall1 = getglobalvar("wall1");
      void wall2 = getglobalvar("wall2");
      void wall3 = getglobalvar("wall3");
      void wall4 = getglobalvar("wall4");
      void wall5 = getglobalvar("wall5");
      void wall6 = getglobalvar("wall6");
      void wall7 = getglobalvar("wall7");
      void wall8 = getglobalvar("wall8");
      void Gambar;

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 8){
          TC = 1;
        }
		
        if(TC == 1){
          Gambar = wall1;
        } else if(TC == 2){
          Gambar = wall2;
        } else if(TC == 3){	
          Gambar = wall1;
        } else if(TC == 4){
          Gambar = wall3;
        } else if(TC == 5){
          Gambar = wall4;
        } else if(TC == 6){
          Gambar = wall3;
        } else if(TC == 7){
          Gambar = wall5;
        } else if(TC == 8){
          Gambar = wall6;
        } else if(TC == 9){
          Gambar = wall5;
        } else if(TC == 10){
          Gambar = wall7;
        } else if(TC == 11){
          Gambar = wall8;
        } else if(TC == 12){
        }
        setglobalvar("TC", TC + 1);
      }

      drawsprite(Gambar, 0, 0, -2500);
      setglobalvar("Time", Time+1);
	
    }
   if(getglobalvar("zoomentity"))
   {
      zoom();      
   }
      mainLoop();
}


Is it possible to put different images in the following locations at the same time?: - Loading menu - Title menu - Select menu

If so, could you show us an example of how update.c and updated.c should look like?  ;D
 
but I can't get this to work for the "alpha1" transparency to work for me.

Alright, here's the updated script:
Code:
 void main(){

   processRushCount();

    if(openborvariant("in_titlescreen")==0 || openborvariant("in_menuscreen")==1){
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void wall1 = getglobalvar("wall1");
      void wall2 = getglobalvar("wall2");
      void wall3 = getglobalvar("wall3");
      void wall4 = getglobalvar("wall4");
      void wall5 = getglobalvar("wall5");
      void wall6 = getglobalvar("wall6");
      void wall7 = getglobalvar("wall7");
      void wall8 = getglobalvar("wall8");
      void Gambar; void Image;

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 8){
          TC = 1;
        }
		
        if(TC == 1){
          Gambar = wall1;
        } else if(TC == 2){
          Gambar = wall2;
        } else if(TC == 3){	
          Gambar = wall1;
        } else if(TC == 4){
          Gambar = wall3;
        } else if(TC == 5){
          Gambar = wall4;
        } else if(TC == 6){
          Gambar = wall3;
        } else if(TC == 7){
          Gambar = wall5;
        } else if(TC == 8){
          Gambar = wall6;
        } else if(TC == 9){
          Gambar = wall5;
        } else if(TC == 10){
          Gambar = wall7;
        } else if(TC == 11){
          Gambar = wall8;
        } else if(TC == 12){
        }
        setglobalvar("TC", TC + 1);
      }

      Image = drawsprite(Gambar, 0, 0, -2500);
      setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);
      setglobalvar("Time", Time+1);	
    }
   if(getglobalvar("zoomentity"))
   {
      zoom();     
   }
      mainLoop();
}

FYI in function:
Code:
setdrawmethod(Image, 1, 255, 255, 0, 0, 0, 1);

That 1 as last parameter defines alpha setting. You can change that if you need to modify alpha setting :)

Is it possible to put different images in the following locations at the same time?: - Loading menu - Title menu - Select menu

Yes, this is updated.c from updated base mod with different animations in main menu and select screen:
Code:
void main(){
    if(openborvariant("in_menuscreen")==1 || openborvariant("in_titlescreen")==1){ // Main menu and title screen stuffs
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void Gambar;

      if(!Gambar){
        Gambar = getglobalvar("Jud1");
      }

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 4){
          TC = 1;
        }

        if(TC == 1){
          Gambar = getglobalvar("Jud1");
        } else if(TC == 2){
          Gambar = getglobalvar("Jud3");
        } else if(TC == 3){
          Gambar = getglobalvar("Jud5");
        } else if(TC == 4){
          Gambar = getglobalvar("Jud7");
        }
        setglobalvar("TC", TC + 1);
      }

      drawsprite(Gambar, 0, 0, -2500);
      setglobalvar("Time", Time+1);
    } else if(openborvariant("in_selectscreen")){ // Select screen stuffs
      int TC = getglobalvar("TC");
      int Time = getglobalvar("Time");
      void Gambar;

      if(!Gambar){
        Gambar = getglobalvar("Jud2");
      }

      if(Time == NULL() || Time >= 40){ // 20 centiseconds
        Time = 0;

        if(TC == NULL() || TC > 4){
          TC = 1;
        }

        if(TC == 1){
          Gambar = getglobalvar("Jud2");
        } else if(TC == 2){
          Gambar = getglobalvar("Jud4");
        } else if(TC == 3){
          Gambar = getglobalvar("Jud6");
        } else if(TC == 4){
          Gambar = getglobalvar("Jud8");
        }
        setglobalvar("TC", TC + 1);
      }

      drawsprite(Gambar, 0, 0, -2500);
      setglobalvar("Time", Time+1);
    }
}

It has 2 sections: main menu+title screen and select screen. No alpha setting there though.
As for loading screen, due to loading process done there, update script doesn't work properly displaying simple timer let alone animation.
 
Thanks my friend!

It has 2 sections: main menu+title screen and select screen. No alpha setting there though.
As for loading screen, due to loading process done there, update script doesn't work properly displaying simple timer let alone animation.

So from what you say, it cannot be created independently for the title screen, or for the main menu?
 
Back
Top Bottom