Forum
Contact





DirectX using C#
DirectX using C++
DirectX using Visual Basic



Latest Forum posts

 Tutorial 3 for Windows Phone 7
  Posted by: Anonymous
  When: 20/05/2013 at 02:30:13

 No download link for 2d series: shooter
  Posted by: zaboleq
  When: 07/05/2013 at 15:46:28

 Collision Class?
  Posted by: Anonymous
  When: 05/05/2013 at 19:03:59

 stack overflow
  Posted by: cityguy
  When: 07/04/2013 at 01:58:38

 Meshes looks strange.
  Posted by: ab_saratov
  When: 01/04/2013 at 04:31:08

 Lamppost Not loaded
  Posted by: Anonymous
  When: 22/03/2013 at 06:43:52

 Collision Class?
  Posted by: Da_Boom
  When: 21/03/2013 at 01:23:09

 Math boggles me
  Posted by: cityguy
  When: 17/03/2013 at 03:44:48

 Collision Class?
  Posted by: Da_Boom
  When: 16/03/2013 at 03:44:42

 Tree update
  Posted by: Anonymous
  When: 15/03/2013 at 21:11:22

 XNA 4.0
  Posted by: Anonymous
  When: 15/03/2013 at 19:43:57

 Error when I try to run.
  Posted by: Anonymous
  When: 15/03/2013 at 19:21:06

 Error With the Effect File
  Posted by: Anonymous
  When: 15/03/2013 at 18:21:01

 Can only get shadowmap
  Posted by: Anonymous
  When: 15/03/2013 at 15:48:52

 Vertex and Pixel Shader Versions?
  Posted by: Anonymous
  When: 15/03/2013 at 15:07:16

 Unsupported properties
  Posted by: Anonymous
  When: 15/03/2013 at 14:23:00

 Problem Loading Skybox
  Posted by: Rana
  When: 15/03/2013 at 10:34:45

 Black Screen Of Death - Help!
  Posted by: Anonymous
  When: 15/03/2013 at 03:43:43

 2.0 anyone?
  Posted by: Anonymous
  When: 15/03/2013 at 02:19:48

 Defitinition of tha rotation axis
  Posted by: Anonymous
  When: 15/03/2013 at 00:55:14




Topic: Removing old smoke trail...



  
Goto parent category
  
Create a new user account


   Removing old smoke trail...
 Poster : jbaisden
 Posts: 1
 Country : usa
 City: Brandon

  
Posted by jbaisden on 06/09/2008 at 10:46:32

Okay, so I've got the 2d tutorial working...well, everything except the last part. I'm getting some wierd error...No matter, that's not why I'm writing.

I'm curious how to remove the old smoke trail from the rocket. Right now, it sort of paints the screen like brush would in Paint. Realistically, the smoke would dissipate after a little while. I'm fine with just removing old smoke trails after so many draws...

Is there a way to simply remove a drawn texture? I'm just getting my feet wet here, but could we just keep an array of all drawn smoke positions and remove those after so many draws...or perhaps after a second...?

Any ideas here would be helpful.
 Poster : jasonbarry
 Posts: 21
 Country : USA
 City: Ringgold

  
Posted by jasonbarry on 07/09/2008 at 10:57:06
You don't remove a drawn texture from the screen, you would just not draw the texture when the Draw method is called.  The positions to draw the smoke texture is stored in smokeList.  When you go to add some positions in the List, you could remove some of the positions at the beginning so that it would give it the effect that the smoke disappears.
 Poster : m_Maky
 Posts: 67
 Country : france
 City: Nice

  
Posted by m_Maky on 07/09/2008 at 15:18:38
what you are describing here is a particle engine. riemer promised a particle engine to handle the explosions, so things like this might be covered there.

i'm just wondering when the next parts of the series will be posted, as it's already been a few days since the last chapter ... not that i'm complaining ;)
 Poster : Anonymous
 Posts:
 Country :
 City:

  
Posted by Anonymous on 01/02/2009 at 17:41:27
Create two bool variable, enableSmoke and smokeIsEnough.
Now in update methom, put a if((rocketflying)||(smokeIsEnough)) for call update rocket.

inside the rocket update Put the lis.remove.... of list class, but only if smokeIsEnough = true.


smokeIsEnough on top of game1 Class = false , change to true when draw the smoke.
EnableSmoke on top of game1 class = false, change to true when the positionrefresh of rocket in updaterocket() and arctangent is seted (when the rocket has been moved) and draw the smoke under condition if(enableSmoke) here in my pc, the smoke draw on xtreme left if the rocket isnt launched (cuz I put rocketflying=false if it get out of screen and only launched if !rocketflying).


if((rocketflying)||(smokeIsEnough)) for call update rocket.  : this two conditions is needed cuz only rocketflying: rocket out the screen, rocketflying = false; THE SMOKE STOPS THE REMOVE!!AND CONTINUES ONLY IF YOU SHOT OTHER ROCKET!! and that isn't realistic



In my work I do some more. if list.count()>50 remove (randomizer(50)) if list.count()>100 remove(ra...(100) and so on, this make more smokes be removed when there are more.


Sorry if I became you confused, but this is my way of think.
 Poster : Anonymous
 Posts:
 Country :
 City:

  
Posted by Anonymous on 14/02/2009 at 09:26:35
just add int n at the beginning and n++ in the update rocket() for cycle and
if (n > 500)
            {
                smokelist.RemoveRange(0, 5);
            }
at the begging of drawrocket()
 Poster : Anonymous
 Posts:
 Country :
 City:

  
Posted by Anonymous on 27/01/2010 at 18:33:57
Just use smokeList.Count() instead of n in the above code.  It is much cleaner.
 Poster : Anonymous
 Posts:
 Country :
 City:

  
Posted by Anonymous on 03/07/2012 at 14:59:01
I created this:

                smokeList.Add(smokePos);
                smokeList.TrimExcess();
                if (smokeList.Count > 0)
                    currentSmoke = smokeList.First<Vector2>();
                if (smokeList.Count > 20 && smokeList.Any())
                    smokeList.Remove(currentSmoke);
            }
            if (!rocketFlying)
                if (smokeList.Count > 0)
                    smokeList.Remove(smokeList.First<Vector2>());
            if (rocketPosition.X < 0 || rocketPosition.X > screenWidth || rocketPosition.Y > screenHeight)
                rocketFlying = false;

It adds up to 21 smoke sprites, then removes the oldest ones, making the trail follow the rocket but not stay. It also allows the trail to "follow" the rocket off the screen, even though no new sprites are being drawn.

  
Post a new reply
 





Google
 
Web www.riemers.net
If you appreciate the amount of time I spend creating and updating
these pages, feel free to donate -- any amount is welcome !
- Website design & DirectX code : Riemer Grootjans -
©2006 Riemer Grootjans


News
Home
Forum
XNA 2.0 Recipes Book (8)
XNA 3.0 Recipes Book (8)
Downloads
Extra Reading (3)
Matrices: geometrical
Matrix Mathematics
Homogenous matrices
Community Projects (1)
Tutorials (160)
XNA 4.0 using C# (89)
DirectX using C# (54)
Series 1:Terrain (14)
Opening a window
Linking to the Device
Drawing a triangle
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing bmp files
Colored vertices
DirectX Light basics
Mesh creation
Mesh lighting
Series 2: Flightsim (19)
Series 3: HLSL (19)
Short Tuts (2)
Resizing problem
Checking Device caps
DirectX using C++ (15)
DirectX using VB (2)