2 registered members (bigsmack, rki),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Need some help =)
[Re: Widi]
#324866
05/23/10 19:05
05/23/10 19:05
|
Joined: Feb 2009
Posts: 80 STRING* location = "Germany";
Minamato
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
|
'türlich sprech ich deutsch ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif) hehe...also: ich habe mir gedacht, dass ich items ins spiel einbaue. da ich jetzt 4 verschiedene drinhaben möchte (einmal, dass der Schläger größer wird, einmal, dass er kleiner wird, einmal einen sich schneller bewegenden Ball und einmal, dass zwei Bälle gleichzeitig erscheinen). ich hab's mir so wie 'n Würfel vorgestellt (durch integer(random(5)+1)): wird die 1 gewürfelt, soll das Item erscheinen, dass den Schläger größer macht "paddlebig_pan". Bei 2 soll das Item erscheinen, dass Ball schneller macht "speedball_pan". Bei 3 das Item, dass den Schläger kleiner macht "smallball_pan". Und zuletzt bei 4 das Item, dass zwei Bälle erscheinen lassen soll "doubleball_pan". hier der Code mit deutschen Kommentaren:
function items() // Funktion zum erstellen der Items
{
paddlebig_pan.flags &= ~SHOW;
speedball_pan.flags &= ~SHOW;
paddlesmall_pan.flags &= ~SHOW;
doubleball_pan.flags &= ~SHOW;
itemhilfe = integer(random(5) + 1); // itemhilfe nimmt einen zufälligen Wert zwischen 1 und 5 an
if (itemhilfe == 1) // wenn die itemhilfe kleiner oder gleich 10 ist, aktiviere das PaddleBig-Item
{
paddlebig_pan.flags |= SHOW;
paddlebig_pan.pos_x += 4*time_step;
paddlebig_pan.pos_y += 2*time_step;
wait(1);
if ((paddlebig_pan.pos_x >= 931) || (paddlebig_pan.pos_y >= 664))
{
paddlebig_pan.flags &= ~SHOW;
}
if ((paddlebig_pan.pos_y > right_pan.pos_y - 12) && (paddlebig_pan.pos_y < right_pan.pos_y + 96) && (paddlebig_pan.pos_x > 943) && (paddlebig_pan.pos_x < 955))
{
big_paddle();
paddlebig_pan.flags &= ~SHOW;
}
}
else if (itemhilfe == 2) // wenn die itemhilfe kleiner oder gleich 20 ist, aktiviere das SpeedBall-Item
{
speedball_pan.flags |= SHOW;
speedball_pan.pos_x += 4*time_step;
speedball_pan.pos_y += 1*time_step;
if ((speedball_pan.pos_x >= 931) || (speedball_pan.pos_y >= 664))
{
speedball_pan.flags &= ~SHOW;
}
if ((speedball_pan.pos_y > right_pan.pos_y - 12) && (speedball_pan.pos_y < right_pan.pos_y + 96) && (speedball_pan.pos_x > 943) && (speedball_pan.pos_x < 955))
{
speedball_pan.flags &= ~SHOW;
ball_speed.x = 3 - 6 * (random(50) % 2); // -3 oder 3, Richtung, in die der Ball beim Start gespielt wird
ball_speed.y = 3 - random(6); // -3...3, zufällige vertikale Geschwindigkeit beim Start des Spiels
}
}
else if (itemhilfe == 3) // wenn die itemhilfe kleiner oder gleich 30 ist, aktiviere das PaddleSmall-Item
{
paddlesmall_pan.flags |= SHOW;
paddlesmall_pan.pos_x += 4*time_step;
paddlesmall_pan.pos_y += -1*time_step;
if ((paddlesmall_pan.pos_x >= 931) || (paddlesmall_pan.pos_y >= 664))
{
paddlesmall_pan.flags &= ~SHOW;
}
if ((paddlesmall_pan.pos_y > right_pan.pos_y - 12) && (paddlesmall_pan.pos_y < right_pan.pos_y + 96) && (paddlesmall_pan.pos_x > 943) && (paddlesmall_pan.pos_x < 955))
{
small_paddle();
paddlesmall_pan.flags &= ~SHOW;
}
}
else if (itemhilfe == 4) // wenn die itemhilfe kleiner oder gleich 40 ist, aktiviere das DoubleBall-Item
{
doubleball_pan.flags |= SHOW;
doubleball_pan.pos_x += 4*time_step;
doubleball_pan.pos_y += -2*time_step;
if ((doubleball_pan.pos_x >= 931) || (doubleball_pan.pos_y >= 664))
{
doubleball_pan.flags &= ~SHOW;
}
}
wait(1);
}
|
|
|
Re: Need some help =)
[Re: Widi]
#324874
05/23/10 19:45
05/23/10 19:45
|
Joined: Feb 2009
Posts: 80 STRING* location = "Germany";
Minamato
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
|
danke! item bewegt sich jetzt wie gewollt in die untere rechte ecke. problem ist jetzt nur, dass, wenn der schläger das item berührt, dieser nicht mehr groß wird. die funktion die dafür benutzt wird ist:
function big_paddle()
{
snd_play (click_wav, 20, 0);
big_use = 1; // setze Variablen und Panels so um, dass BigPanel erscheint
right_pan.flags &= ~SHOW;
right_panbig.flags = SHOW | OVERLAY;
wait(-30); // warte 30 Sekunden
big_use = 0; // setze sämtliche Panels und Variablen wieder auf Normalzustand
right_pan.flags |= SHOW;
right_panbig.flags &= ~SHOW;
}
diese funktion wird in der funktion create_paddle_big() aufgerufen, also in der neuen while-schleife:
function create_paddle_big()
{
paddlebig_pan.flags |= SHOW;
while(is(paddlebig_pan,SHOW))
{
paddlebig_pan.pos_x += 4*time_step;
paddlebig_pan.pos_y += 2*time_step;
if ((paddlebig_pan.pos_x >= 931) || (paddlebig_pan.pos_y >= 664))
{
paddlebig_pan.flags &= ~SHOW;
}
if ((paddlebig_pan.pos_y > right_pan.pos_y - 12) && (paddlebig_pan.pos_y < right_pan.pos_y + 96) && (paddlebig_pan.pos_x > 943) && (paddlebig_pan.pos_x < 955))
{
big_paddle();
paddlebig_pan.flags &= ~SHOW;
}
wait(1);
}
}
weißt du warum das jetzt so ist?
|
|
|
Re: Need some help =)
[Re: Minamato]
#324875
05/23/10 19:47
05/23/10 19:47
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
Wieder einer deiner Fehler: right_panbig.flags = SHOW | OVERLAY; right_panbig.flags |= SHOW | OVERLAY;
Last edited by Widi; 05/23/10 19:49.
|
|
|
|