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 / Particles On 2D Background Created using Sprites.

Author
Message
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 17th Feb 2011 01:14
Hello everyone!
I have some troubles with particles rendering. Can Somebody help me with such problem. My Particles didn`t render on my backgound. I called finction dbDrawSpritesFrst () but it still nothing. On the blue screen everythink works just fine. Please help..

Dark GDK IS THE BEST!!!!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 17th Feb 2011 09:09
I have a sprite that moves across the screen. Needs to be done so that the particles were produced by this sprite, and created a trace of the movement sprites on the screen. Please advise how this can i make it ...

Dark GDK IS THE BEST!!!!
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 17th Feb 2011 21:27
If you're getting a blue screen for the background then you have something 3d going on which means the 3d scene is rendered when you Sync. This draws the 3d scene over the top of 'DrawSpritesFirst'. By turning the 3d backdrop off the sprites will show up but you will have to add CLS yourself.

Warning! May contain Nuts!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 17th Feb 2011 22:33
I allready solved this one. But Now I want to create some particles- effect. Something more then just simple squares.I think it is imposibble to create something cool effects.(( And can`t load effects...

Dark GDK IS THE BEST!!!!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 17th Feb 2011 22:41
Quote: "I think it is imposibble to create something cool effects"

i dont quite see "why"

WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 18th Feb 2011 14:25
You can find using google some tile maps with some pretty cool animated sprites. You could use various explosions on your particles, rotate them, have them affected by gravity, etc. No end to the possibilities for particle effects even using 2d.

Warning! May contain Nuts!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 19th Feb 2011 14:40
Maybe you right... Can you help me to calculate the position of particles emission in the 3d space from width and height of my screen? I have some problems with that. I didnt know that i can set the animated texture on the sprite. I didn`t find such function in DGDK help..

Dark GDK IS THE BEST!!!!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 19th Feb 2011 14:46
I mean I need my particles emission position should follow my mouse. In examples there is an example that shows how to do that, but i have 1024*768 screen resolution. And i can`t understand where did they get the numbers. 320 is the half of screen width but what 200 means?


// Dark GDK - The Game Creators - www.thegamecreators.com

// include Dark GDK header file
#include "DarkGDK.h"

// main entry point for program
void DarkGDK ( void )
{
// switch to media directory
dbSetDir ( "media\\" );

// set sync rate
dbSyncOn ( );
dbSyncRate ( 0 );

int ImageNumber = 1;
int ImageNumberB = 2;

// load images
dbLoadImage ( "fire.bmp", ImageNumber );
dbLoadImage ( "sky\\spacesphere.jpg", ImageNumberB );

// load sky box
dbLoadObject ( "sky\\ss.x", 1 );
dbScaleObject ( 1,150,150,150 );
dbSetObject ( 1,1,1,1,1,0,0,0 );
dbSetObjectTexture ( 1,2,1 );

// set camera properties
dbSetCameraRange ( 1,10000 );
dbPositionObject ( 1, 0, 3, 0 );
dbYRotateObject ( 1,180 );

// make a new box
dbMakeObjectBox ( 2,100,20,50 );
dbPositionObject ( 2,0,-25,50 );
dbTextureObject ( 2,ImageNumberB );
dbGhostObjectOn ( 2,2 );

// create particles
int ParticleNumber = 1;
dbMakeParticles ( ParticleNumber, ImageNumber, 50, 20.0f );
dbPositionParticles ( ParticleNumber, 0, -58, 0 );
dbColorParticles ( ParticleNumber, 255, 128, 0 );
dbSetParticleEmissions ( ParticleNumber, 10 );
dbSetParticleSpeed ( ParticleNumber, 0.01f );
dbSetParticleGravity ( ParticleNumber, 2 );

// position camera
dbPositionCamera ( 0,3,0 );
dbPointCamera ( 0,3,400 );

// main loop
while ( LoopGDK ( ) )
{
// quit on escape key
if ( dbEscapeKey ( ) )
return;

// adjust particle positions
dbPositionParticleEmissions ( ParticleNumber, ( dbMouseX ( ) - 320 ) / 40.0f * 20, ( 200 - dbMouseY ( ) ) / 40.0f * 20, 10 * 20 );

// change colours on mouse click
if ( dbMouseClick ( ) )
{
dbColorParticles ( ParticleNumber, dbRnd ( 255 ), dbRnd ( 255 ), dbRnd ( 255 ) );
}

// update screen
dbSync ( );
}
}

Dark GDK IS THE BEST!!!!
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Feb 2011 01:40
Since I've moved over to GDK I've not yet explored the built in particles. I've always used my own. I'm assuming though the particles can be setup similar to the effects you see in Quake and Unreal. Fire and smoke effects. Explosions would use gravity and fall down, where smoke floats upwards...

Regarding the mouse coords. You can get the mouse coords using dbMouseX and dbMouseY. dbPickScreen is used for converting 3d screen coords from 2d.

Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-10-02 15:17:22
Your offset time is: 2024-10-02 15:17:22