Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / flashing/repeating object, dbLoopObject doesnt work

Author
Message
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 11th Jun 2009 01:35
making an object sorta flash in itself, lets say i have a white image and i want it to flash and keep flashing when the mouse button is pressed..
by flash i mean
:: flash = appear then dissapear, or reduce opacity then increase opacity/reduce transparency the increase transparency.
i cant seem to figure out how to do it,
i tried the loop command but doesnt really work
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 12th Jun 2009 05:42
seriously anything? i searched, didnt find anything useful , btw here is the game i'm making, what i need to make flash in and out is the white part of the scope http://www.youtube.com/watch?v=1AxNdvluqq4
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 12th Jun 2009 17:43 Edited at: 12th Jun 2009 17:43
LOL that video made me laugh.

I still dont understand exactly what you want.

thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 13th Jun 2009 04:12
u know the part when i zoom into the scope, when you shoot, a white flash comes across the scope, when you hold the mouse button the white flash stays there without moving or anything, i wanted the flash to sorta pulse in and out really fast as the mouse button is held down.
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 13th Jun 2009 05:14 Edited at: 13th Jun 2009 05:45
You could make a static variable (or make a class/struct) that you use to set a sprite's transparency with dbSetSpriteAlpha(int Sprite, int Transparency) with 255 being completely solid and 0 being invisible. Then you can increase/decrease the variable and set the sprite's transparency with it. This:



Should work, but I haven't tested it and have never tried to do what you want to achieve.

EDIT: Works now.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 13th Jun 2009 06:38
wait wat? this whole sprite talk got me confused, and sorta thirty,how would i make a static variable (or make a class/struct)? i thought sprites were for 2d games so i really never bothered to learn about em......can u please explain it to me as if i was a noob?
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 13th Jun 2009 06:45 Edited at: 13th Jun 2009 06:47
was?

Basically, you get your gun's "flash" as an image, load it up into the game then convert to a sprite, every frame fix it to the tip of the guns barrel.

You probably want to set the sprites alpha to 0 initially.

Every time a "bullet" comes out of the gun, make the sprites alpha go to 255 for a few frames then back to 0.

The end result is a muzzle flash when your gun fires, just like on real guns


BANG! BANG!

Merak Spielman
16
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 13th Jun 2009 09:32
A lot of 3d games use sprites - essentially a 2d image suspended in 3d space. They're used for decals, to indicate bulletholes or damage to character models, for instance. They're used for HUD displays, health bars, and so on. You'll need them for menu screens. You can use them to add a visual effect to the screen - like the white flash you're talking about. Much simpler to add a semi-transparent 2d sprite across the entire screen than to make a 3d lighting effect (and faster). You could also use red flashes to indicate damage, or green flashes for poison, etc.
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 13th Jun 2009 09:47
Just thought of this, Alternatively you could just have the muzzle flare as part of your guns animation.

thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 13th Jun 2009 19:21
i would love to do all this great stuff you are all suggesting the problem now is, i load the image, position it, now how do i convert it to a sprite?
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 13th Jun 2009 20:00
Use dbSprite() instead of pasting the image. Look in the documentation for it <Drive with DarkGDK>:\Program Files\The Game Creators\Dark GDK\Documentation\Dark GDK.chm

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 15th Jun 2009 23:42
ok i keep trying but it just wont work, i tried to deviate away from my original game code and make a whole new thing just to test the code i was given heres wat i came up with (which didnt work)
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Jun 2009 04:28
Okay, there are a couple of things wrong.

1. Typo: "else if(trans 1= 0)" should be "else if(trans != 0)"

2. A sprite needs to have an image loaded first. You need to load the image, and then make the sprite.



Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 16th Jun 2009 05:50 Edited at: 16th Jun 2009 05:53
still no joy

Attachments

Login to view attachments
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Jun 2009 14:10
Yeah, sorry I had 2 typos in that

Here:



PS - You really should learn to use the output window in visual studio. You can double click on each error and the cursor will be set on the line that is the problem. It is usually straightforward enough to fix typos.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 16th Jun 2009 15:04
ya i pressed f in that window and it pointed to the lines, i dont know that much about this sorta stuff yet so i didnt know what to fix
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 16th Jun 2009 15:10 Edited at: 16th Jun 2009 16:02
PERFECT! THANKS A MILLION!!!!!! I KNEW I COULD COUNT ON YOU GENIUSES FOR HELP!!!(I'm not being sarcastic, i'm serious) WOOOO!!!! now to move the sprite into the correct place and make it gently fade out when mouse i sreleased(if thats possible);
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Jun 2009 18:33
Almost anything is possible!

Here's what I think you are looking for.



Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
thm120
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location:
Posted: 16th Jun 2009 19:29
aw ur the best

Login to post a reply

Server time is: 2024-11-05 23:25:42
Your offset time is: 2024-11-05 23:25:42