Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Akow), 1,361 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 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 | chip programmers | 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