Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animation Runs Slow

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
US
I am creating a Space invaders game.
I have one timer that moves 36 imageboxes across the gui. But when they begin to move the entire program slows down including the time that controls the base ship.
I guess moving this many image boxes causes the program to bog down the program.

Is there a way around this?
I tried to change the interval and it did not fix the problem??!
 

One of the various different way to accomplish what I think you are wanting to do is to use the LockWindowUpdate API...
[tt]
Private Sub Timer1_Timer()
Dim I As Integer
Timer1.Enabled = False
LockWindowUpdate Me.hWnd
For I = 0 To 35 'or 1 to 36 however you have it...
'move each box required amount
Next I
LockWindowUpdate 0
Timer1.Enabled = True
End Sub
[/tt]

You will have to use the API Viewer to get the definition for LockWindowUpdate and see help for more info.

Good Luck

 
You may struggle with getting decent fast moving stuff in VB alone. Do a keyword search on this forum only for 'DirectX' where the issue has been dealt with several times.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Part of the problem was I was switching images in the imageboxes using loadpicture.

I now have invisiible images on the gui and I use them to switch the picture.

Thanks everyone, I will definitely look into the other suggestions.
 
Imageboxes are a bad idea. Either lear direct X or use graphic API. The second option is probably simple, since for the beginning, using the BitBlt API will do. It is well documented in MSDN and APIGuide (at allapi.net).

scisoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top