Graphic Overload
Graphic Overload
Graphic Overload
Graphic Overload
Graphic Overload
Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload
Graphic Overload Graphic Overload
Graphic Overload
Go Back  Xtreme Visual Basic Talk > > > Graphic Overload


Reply
 
Thread Tools Display Modes
  #1  
Old 06-18-2006, 09:03 AM
TristanZ's Avatar
TristanZ TristanZ is offline
Newcomer
 
Join Date: Apr 2006
Posts: 6
Question Graphic Overload


I'm making a space shooter similar to space invaders.

I created a 'bullet' class so that there was no limit to the amount of times you could shoot. Every time you click, it draws a new bullet w/out effecting the other ones. However, after a number of bullets, say 100+, the game begins to get jerky in its motions, even after all the bullets have gone offscreen. How can I remedy this?
Reply With Quote
  #2  
Old 06-18-2006, 09:28 AM
MikeJ's Avatar
MikeJGraphic Overload MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Are you disposing of the bullet objects after they have cleared the screen?
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #3  
Old 06-18-2006, 09:56 AM
TristanZ's Avatar
TristanZ TristanZ is offline
Newcomer
 
Join Date: Apr 2006
Posts: 6
Default

No. How would I go about doing that?

I don't think I can. I'm actually just drawing on the form using this code:

If firing = True And where.Y > 0 Then
Form2.CreateGraphics.DrawImage(bullet, where)
where.Y = where.Y - 10
End If

firing is the boolean assigned to the click event
where is the PointF location of the bullet

EDIT: I have tried this code:

Public bullet As Bitmap

Public Sub movement_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles movement.Tick
If firing = True And where.Y > 100 Then

Form2.CreateGraphics.DrawImage(bullet, where)
where.Y = where.Y - 10
If where.Y < 100 Then
bullet.Dispose()
Form2.CreateGraphics.Dispose()

End If

End If

Unfortunately, that doesn't work. Am I doing it wrong?

Last edited by TristanZ; 06-18-2006 at 03:13 PM.
Reply With Quote
  #4  
Old 06-21-2006, 07:14 AM
TristanZ's Avatar
TristanZ TristanZ is offline
Newcomer
 
Join Date: Apr 2006
Posts: 6
Default

Thanks! It works! I just had to dispose of all the objects related to the bullet, and I had forgotten the timer!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Graphic Overload
Graphic Overload
Graphic Overload Graphic Overload
Graphic Overload
Graphic Overload
Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload Graphic Overload
Graphic Overload
Graphic Overload
 
Graphic Overload
Graphic Overload
 
-->