Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Funktionen abruppt beenden und weitermachen.. #139164
07/02/07 11:25
07/02/07 11:25
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
Also folgendes

Ich habe ein Code geschrieben das per Alpha Ein Text und ein Bild eingeblendet wird. Dazu kommt dann noch Musik. Das ganze dient als Intro. Nun möchte ich, das beim Druck auf die Taste ESC die komplette function intro() abgestoppt wird und mit function hauptmenue() weitergemacht wird. Da wird dann Musik gestoppt, Text und Intro Bilder ausgeblendet.

Ich habe das ganze soweit bisher.

Code:
... //intro_music() und anderes Zeug...

function hauptmenue()
{
media_stop(intromusic);
intro1.visible = off;
intro2.visible = off;
intro3.visible = off;
}

function intro()
{
on_esc = hauptmenue; //Wenn Escape gedrückt wird überspring das Intro
intro1.visible = on;
intro2.visible = on;
intro3.visible = on;
game_font.visible = on;
intro_music();
game_font.pos_x = 90;
str_cpy(eingabe,"Sieben Jahre sind vergangen, seid dem massiven Angriff der Flax."); //Text wird eingetragen
while (intro1.alpha < 100)
{
intro1.alpha += 2*time;
wait(1);
if (game_font.alpha < 100)
{
game_font.alpha += 1*time;
wait(1);
}
}
sleep(2);
... usw



Wie stoppe ich nun die intro Funktion. Er springt zwar ins Hauptmenü allerdings läuft funktion intro weiter. Das schlimme daran ist, dass er am Ende vom Intro das Hautpmenue nochmal aufrufen würde..

Hier der Code

Code:
...
while (intro3.alpha > 0)
{
intro3.alpha -= 4*time;
wait(1);
if (game_font.alpha > 0)
{
game_font.alpha -= 4*time;
wait(1);
}
}
intro3.visible = off;
sleep(1);
hauptmenue();
}



Was kann ich tun?

MFG Moerk


"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.
Re: Funktionen abruppt beenden und weitermachen.. [Re: Moerk] #139165
07/02/07 11:36
07/02/07 11:36
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
z.b. if (key_esc) {intro3.alpha = 0;} in die schleife schreiben

Re: Funktionen abruppt beenden und weitermachen.. [Re: ello] #139166
07/02/07 11:58
07/02/07 11:58
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
An die Lösung habe ich auch schon gedacht allerdings ist es dann ein wenig viel schreibarbeit da ich von intro1 ab alle umstellen muss und dazu kommt ja dann noch das sie wieder ausgeblendet werden.

Hier der Code für den kompletten intro1 Teil:

Code:

intro1.visible = on;
intro2.visible = on;
intro3.visible = on;
game_font.visible = on;
intro_music();
game_font.pos_x = 90;
str_cpy(eingabe,"Sieben Jahre sind vergangen, seid dem massiven Angriff der Flax."); //Text wird eingetragen
while (intro1.alpha < 100)
{
intro1.alpha += 2*time;
wait(1);
if (game_font.alpha < 100)
{
game_font.alpha += 2*time;
wait(1);
}
}
sleep(2);
while (intro1.alpha > 0)
{
intro1.alpha -= 4*time;
wait(1);
if (game_font.alpha > 0)
{
game_font.alpha -= 4*time;
wait(1);
}
}



Also demnach müsste ja das ja dann so aussehen

Code:

intro1.visible = on;
intro2.visible = on;
intro3.visible = on;
game_font.visible = on;
intro_music();
game_font.pos_x = 90;
str_cpy(eingabe,"Sieben Jahre sind vergangen, seid dem massiven Angriff der Flax."); //Text wird eingetragen
while (intro1.alpha < 100)
{
intro1.alpha += 2*time;
wait(1);
if (key_esc == on)
{
intro1.alpha = 100;
game_font.alpha = 100;
// Und was nun hier?
}

if (game_font.alpha < 100)
{
game_font.alpha += 2*time;
wait(1);
}
}
sleep(2);
while (intro1.alpha > 0)
{
intro1.alpha -= 4*time;
wait(1);
if (game_font.alpha > 0)
{
game_font.alpha -= 4*time;
wait(1);
}
}



edit:

Der übersicht halber es geht dann direkt dannach so weiter..

Code:

game_font.pos_x = 80;
str_cpy(eingabe,"blablabla..."); //Text wird eingetragen
intro1.visible = off;
while (intro2.alpha < 100)
{
intro2.alpha += 2*time;
wait(1);
if (game_font.alpha < 100)
{
game_font.alpha += 2*time;
wait(1);
}
}



Last edited by Moerk; 07/02/07 12:01.

"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.
Re: Funktionen abruppt beenden und weitermachen.. [Re: Moerk] #139167
07/02/07 14:45
07/02/07 14:45
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
Habs hinbekommen. Benutze Variablen als Lösung. Falls es jemandem hilft...

Code:

function intro()
{
intro_abbrechen = 0;
die weitere Funktion....



Code:

function intro_abbruch
{
while(1)
{
if (key_esc == 1 && intro_abbrechen == 0) // Abbruchfunktion
{
intro_abbrechen = 1; //Wenn auf 1 gesetzt wird, wird das Intro unterbrochen
hauptmenue();



Gruß!


"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1