creating a thunder effect ?

Started by uswin, Thu 28/06/2007 18:41:33

Previous topic - Next topic

uswin

hallo everyone, i want to ask something, how can i create such a thunder effect
i mean i want my character to stepback everytime the thunder effect (lightning effect)is occured every 5/10 second concurent with shakescreen is it possible ? to create such event ?

rancidrat

Yeah you can do it
I dont have my manual here so I dont know the code off hand.
But what I would do is:
Make a timer when the room starts
Settimer(1,50);

then in the repeately execute section I would say this:

If (Istimerexpired(1) ==1)
{
1. play sound  --  thunder sound
2. rawdraw save screen    --- see manual under Room section
3.rawdrawimage or colour to make the lightning effect  see manual under Room section
4. wait(1)  ---Wait a short time for the people to see the effect
5. Shakescreen -- see manual under SREEN
6. rawdraw restore screen --- Lightning Flash stops
7. C.player.Move() --- make the player move back
8. Settimer(1,50) -- Reset the timer
}

If you dont know what I mean then I will paste for you the exact code from the manual. But im pretty sure this sould give you the right effect!


uswin

thanks guy, i am gonna try this as soon as possible !
thanks !

Ishmael

I'd do the flicker with a full-screen size GUI, and timing is, atleast for me, easier to control through a variable increasing with every run of repeatedly_execute, and set to zero every time the lightning strikes. You can use a random under if (lightningdelay > GetGameSpeed() * 5) to create variance in the delay, and trigger the lightning at GetGameSpeed * 10 of the variable to set the max delay to 10 seconds.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

rancidrat

This kinda looks ok:
script for Room: Player enters room (after fadein)
 
SetTimer(1,50);

script for Room: Repeatedly execute
 

if (IsTimerExpired(1)==1)
{
PlaySound(1);       //Sound1.wav must be the thundersound
RawSaveScreen();    // Save the current screen in memory
RawClearScreen(15); // Makes the background White
Wait(10);           // Pauses the game so that you can see
RawRestoreScreen(); // Brings back the original background
ShakeScreenBackground(4, 4, 5); // Shakes the screen
SetTimer(1, Random(200));    // resets the timer
}

The other option is to put RawDrawImage(0,0,6);  instead of the RawClearScreen(15) function, where the 6 is the image slot of a background image the same as the rooms one accept for some cool lightning stuff drawn unto it.



R4L

Akumayo also has a module for this. Search it up.

SMF spam blocked by CleanTalk