RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help
RPG Problem Please Help RPG Problem Please Help
RPG Problem Please Help
Go Back  Xtreme Visual Basic Talk > > > RPG Problem Please Help


Reply
 
Thread Tools Display Modes
  #21  
Old 11-27-2004, 09:03 AM
Iceplug's Avatar
IceplugRPG Problem Please Help Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default


Do you not get this error here?
Thistile = Tiles(x, y)
I have to turn it into something
Thistile = clsMap.Tiles(x, y)

And now, what on earth have you done to the loop?
Code:
For x = 0 To Game.map.Width For y = 0 To Game.map.Height x = 43 * 30 y = 32 * 30 'backslash for integer division. fx = (43) * 30 fy = (32) * 30 'backslash for integer division. Thistile = clsMap.Tiles(x, y) fx = (Thistile Mod 43) * 30 fy = (Thistile \ 32) * 30 e.Graphics.DrawImage(tileset, 30 * x, 30 * y, New Rectangle(fx, fy, 30, 30), GraphicsUnit.Pixel) Next Next
Why are you setting x to 43 * 30 in the first line? A number that big is definitely out of bounds for the array.
And furthermore, X and Y are the loop variables... they don't need to be set to anything.
fx = (43) * 30
fy = (32) * 30 'backslash for integer division.
That looks quite odd. Backslash for integer division, except for that being a multiplication... I don't see the point of it.

Code:
Tilepics = New Bitmap(3) {} 'load pictures into the tilepics array. 'Element 0 is blank to correspond with the fact that 'you are not using 0s in your map.
You just cut and pasted that into your Paint event. I expect for you to do something besides cut and paste. You aren't using it anywhere, so why add it?

You also do not have the picture in tileset, so you aren't going to be able to draw anything from it.

Dim tileset As Bitmap 'sits idle in the form class, never having a picture.
I would've expected it to be in the map class.

Take some time to work things through. I am not giving you the code - I am supplying hints for you to build the code.
Well, you did set the big bitmap up correctly.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #22  
Old 11-27-2004, 09:49 AM
Talus123 Talus123 is offline
Regular
 
Join Date: Sep 2004
Posts: 57
Default

Ok so I fixed what I could. I still do not understand how to move further in the tileset and the tilepics. I do not know what to do now. I posted my new code with my changes.
Reply With Quote
  #23  
Old 11-29-2004, 08:31 AM
Iceplug's Avatar
IceplugRPG Problem Please Help Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Which method are you going to use for drawing your map? Have all of the tiles in an array and just select the array member, or to have all of the tiles in one bitmap and then just draw from some portion of the bitmap?

Select a reality

---- EITHER -------------------------(single bitmap)

Public Tileset(,) As Bitmap
Tileset is a single bitmap object.
Public Tileset As Bitmap

In tileset, you will put the Tilepics.bmp that you just created.

------- OR ----------------------------(bitmap array)

Code:
        Tilepics = New Bitmap(3) {}
        'load pictures into the tilepics array.
        'Element 0 is blank to correspond with the fact that
        'you are not using 0s in your map.
If you are planning on using the Tilepics() array, then it needs to be declared in the Map object instead of on the form, and from there, you'd load the bitmaps into the array in the Sub New.
This would be 1.jpg, 2.jpg, and 3.jpg in tiles\basis folder.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #24  
Old 12-26-2004, 05:57 PM
ThePentiumGuy ThePentiumGuy is offline
Regular
 
Join Date: May 2003
Posts: 53
Default

Wow, I go out of my way to make a tutorial on this (http://www.vbprogramming.8k.com/tuto...ogrammingI.htm) and I get no credit whatsoever for my source. Talus123, I'm really disappointed in you.

And as for your collision detection, I uploaded a sequel to this tutorial (http://www.vbprogramming.8k.com/tuto...grammingII.htm).

Iceplug, do you mind if I take some of the optimization tips you gave me and use it on the next tutorial?

-The Pentium Guy
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
RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help RPG Problem Please Help
RPG Problem Please Help
RPG Problem Please Help
 
RPG Problem Please Help
RPG Problem Please Help
 
-->