Jump to content

  • Log In with Google      Sign In   
  • Create Account


shrink code


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 20 March 2012 - 05:55 PM

is there anyway to condense this code


Image curImage1 = Image.FromFile(@"c:\Users\phil\Desktop\brick1.bmp");
g.DrawImage(curImage1, 0, 0);


Image curImage2 = Image.FromFile(@"c:\Users\phil\Desktop\brick1.bmp");
g.DrawImage(curImage2, 150, 0);


Image curImage3 = Image.FromFile(@"c:\Users\phil\Desktop\brick1.bmp");
g.DrawImage(curImage3, 300, 0);


Image curImage4 = Image.FromFile(@"c:\Users\phil\Desktop\brick1.bmp");
g.DrawImage(curImage4, 450, 0);


Image curImage5 = Image.FromFile(@"c:\Users\phil\Desktop\brick1.bmp");
g.DrawImage(curImage5, 600, 0);

Sponsor:

#2 Washu   Senior Moderators   -  Reputation: 4639

Like
0Likes
Like

Posted 20 March 2012 - 06:07 PM

why are you loading the same image 5 times and then drawing it in 5 different positions. Load it once. Draw it five times.

Also, for loop, read up on it.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#3 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 20 March 2012 - 06:15 PM

thanks washu, that helped,do you know of anywhere I can get help with collision detection and breakout game and c#

#4 Washu   Senior Moderators   -  Reputation: 4639

Like
0Likes
Like

Posted 20 March 2012 - 07:10 PM

Coldet depends, but since you're using 2d... I would probably look at something like box2d. Its a 2d physics engine and has C# ports out there (google em). That includes collision and collision response.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#5 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 20 March 2012 - 07:13 PM

so I should read up on bounding box collision detection?

#6 Washu   Senior Moderators   -  Reputation: 4639

Like
0Likes
Like

Posted 20 March 2012 - 07:16 PM

Yes, you should. Its pretty simple (in 2d) but its a nice thing to know and understand. You should read up and understand both OOBB (object oriented bounding boxes) and AABB (axis aligned bounding boxes) and how to perform coldet on them.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#7 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 20 March 2012 - 07:20 PM

thanks I will




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS