Simple Game
Simple Game
Simple Game
Simple Game
Simple Game
Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game
Simple Game Simple Game
Simple Game
Go Back  Xtreme Visual Basic Talk > > > Simple Game


Reply
 
Thread Tools Display Modes
  #41  
Old 04-23-2007, 01:51 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default


Ah...now I know why it's so slow just after seeing the first few lines

The problem is you're loading a file every time there's movement. A MUCH quicker way would be to either store those pics to an array or other variable(s), or the even more preferred, to put them into your resources.

Next, the problem is with Refresh...that can also cause a lot of lag. And it's not really needed if you're changing the picture, it will refresh for you.

Other than that, I haven't looked further at the code...try those things out I said and it should clear up a lot of slow issues. If you have other problems lemme know.
Reply With Quote
  #42  
Old 04-24-2007, 07:46 AM
SNBoggs's Avatar
SNBoggs SNBoggs is offline
Freshman
 
Join Date: Mar 2007
Location: Canton, GA
Posts: 30
Default

Could you give my an example of how to put the pictures into an array? And what do you mean by putting them in my resources?

As for the Refresh, should I just remove those commands from the code all together?
Reply With Quote
  #43  
Old 04-24-2007, 01:29 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

Remove refresh since pictureboxes will do that for you.

Um...to put them in a resource, simply drag and drop the file to your resource folder. From there, find the resource file by the form file and open it up. Drag the file into that as well and it should name it without it's extension.

Then do:
PictureBox.Image = CImage(Resources.ResourceManager.GetObject("the resource name without extension"))

That should work...I've only done it in C#, not sure if CImage is a valid conversion, but you'll need to convert resources.etc to an image. Maybe take out CImage and just have VB convert for ya
Reply With Quote
  #44  
Old 04-24-2007, 08:29 PM
SNBoggs's Avatar
SNBoggs SNBoggs is offline
Freshman
 
Join Date: Mar 2007
Location: Canton, GA
Posts: 30
Default

Is this so-called resource folder anything like the bin folder that I see?
Reply With Quote
  #45  
Old 04-25-2007, 01:37 AM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

No, it's in the project window of the designer.
Reply With Quote
  #46  
Old 04-30-2007, 08:20 AM
SNBoggs's Avatar
SNBoggs SNBoggs is offline
Freshman
 
Join Date: Mar 2007
Location: Canton, GA
Posts: 30
Default

Targe,

I was talking to one of my classmates and he suggested drawing rectangles or bitmaps for the logs in place of the pictureboxes. Would this be plausible? He helped me on it a bit but we had some trouble getting them to draw to the form. Here is updated code with this new idea in progress...

P.S.: The new code is highlighted...
Attached Files
File Type: rtf Frogger Code.rtf (16.4 KB, 7 views)
Reply With Quote
  #47  
Old 04-30-2007, 11:24 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

That would be GDI, and I'd recommend it, yes...but judging by your experience I'm not sure you'd wanna do it at this point. Your decision though.

By the way, how's the speed working out now? Hope that helped with your speed issues.
Reply With Quote
  #48  
Old 05-01-2007, 05:29 AM
SNBoggs's Avatar
SNBoggs SNBoggs is offline
Freshman
 
Join Date: Mar 2007
Location: Canton, GA
Posts: 30
Default

Well, after removing the refresh statements I was able to tell a difference but i'm still unsure what you meant by resources and where to find them in teh designer.
Reply With Quote
  #49  
Old 05-01-2007, 01:15 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

It should be found in the Solution Explorer box, make sure you're showing all files there. I've only used C# for it but I'd assume VB would have it too.
Reply With Quote
  #50  
Old 05-02-2007, 08:10 AM
SNBoggs's Avatar
SNBoggs SNBoggs is offline
Freshman
 
Join Date: Mar 2007
Location: Canton, GA
Posts: 30
Default

Well, the code that I posted seems to be my old code. Here's the code with the partial GDI added in. I'm not really sure what I need to do next...

You also suggested putting all the log pictures into an array. How would I do that?
Attached Files
File Type: rtf Frogger Code.rtf (49.5 KB, 3 views)
Reply With Quote
  #51  
Old 05-02-2007, 12:28 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default

Dim PicArr(num of pics) As Image

PicArr(0) = Image.FromFile("path")
etc.

Then you just use PicArr(0) for that image instead of calling it from the file each time. Resources are preferred though. And since you're still loading all your pics currently from a file, you're going to have speed issues again. Once you switch to an array or resources, you'll notice a huge difference.
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
Simple Game
Simple Game
Simple Game Simple Game
Simple Game
Simple Game
Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game Simple Game
Simple Game
Simple Game
 
Simple Game
Simple Game
 
-->