All pastes #2122182 Raw Edit

A.J

public text v1 · immutable
#2122182 ·published 2012-02-27 21:26 UTC
rendered paste body
i created an array of locations i want it to spawn dust that i new wouldnt be over any furnature
        int[,] a = new int[,]
	    {   // put the locations of your objects in a comment here for reference
	   

             //list dust co-ordinates here
             {x,y},
             {x,y},
             {x,y}
	    };


then use a structure for storing dust information
            public Vector2 Position;  // dust position
            public int Exists;               //whether dust exsist
            public Rectangle Rectangles { get; set; }  //rectangle for the dust particle


in the  protected override void Draw(GameTime gameTime) method i call to 2 methods i made > setuprubbish() and drawrubbish()
this inside the spriteBatch.Begin(); and End();


inside setup rubbish you want to set its position,
as there are five you will want to have a loop that goes round 5 times, use a changeable variable thing!  int MAXDUST = 5; then if ( NumberOfDusts is <= MAXDUST)


if dust.exists = 0 //you only want to run the setup rubbish if a piece of dust doesnt exist
dust.position  = new vector2d( a[index,0]a[index,1])   //this vector calls to the array of positions use a variable to change array index   0 = x; 1 = y
dust[i].Rectangles = r[i] = new Rectangle(a[index, 0], a[index, 1], width, height);     //this uses the same location for the rectangle
dust.exists = 1
index++;

inside drawrubbish you want another loop and to draw the rubbish if it exists
for i = 0 i<= maxdust i ++
if dust.exists = 1 // only draw if it exists
 spriteBatch.Draw(dustTexture, new Vector2(dust[i].Position.X, dust[i].Position.Y), dustTextures[i].Rectangles, Color.White);



these will be called every 60 seconds and will draw the dust,

inside your collision detection you need to set exists = 0 when you colide, this will then change the location of the dust you collected and then re draw it after the location has been changed, hope this helps.

if this is a bit confusing i can try walk you through it in person in the lab unless somebody else can give better advice, im sure they can :p