Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error
Making a tile map but ran into a error Making a tile map but ran into a error
Making a tile map but ran into a error
Go Back  Xtreme Visual Basic Talk > > > Making a tile map but ran into a error


Reply
 
Thread Tools Display Modes
  #21  
Old 09-30-2007, 03:37 PM
Targe Targe is offline
Contributor
 
Join Date: Nov 2006
Posts: 615
Default


Ah, well done Cags, I think his problem might be in his file path string then.
Reply With Quote
  #22  
Old 09-30-2007, 05:55 PM
Dekaras Dekaras is offline
Freshman
 
Join Date: Apr 2007
Posts: 28
Default

I would agree it sounds like a file path problem which would indeed be embarrasing if it is.

But very early in the this thread I posted about me commenting out this tile map array and just manually adding one tile with the same file path and it worked then.
Quote:
I commented out
Code:
map.ReadMap("map.txt")
Then I just tried loading a one single picture(tile) with the paint event.
Code:
e.Graphics.DrawImage(New Bitmap("tiles\1.jpg"), 5, 5)
And The next debug had no errors and the picture loaded perfectly.
When you debug it will use the debug folder as the starting folder. This is where it will look for all the files unless you tell it to look somewhere else.

These Files I have in the debug folder:
map.txt
tiles <--- folder

In the tiles folder I have the 1.jpg

So to me it still looks like I don't have a file path problem.
Although you used the same code I'm using but you had no problems with it.

I don't know what else to say about this..
Reply With Quote
  #23  
Old 10-01-2007, 02:17 AM
Cags's Avatar
CagsMaking a tile map but ran into a error Cags is offline
Contributor

* Expert *
 
Join Date: Jul 2003
Location: Leicestershire, England
Posts: 710
Default

All I can suggest is trying an absolute path, change the code so that it actually reads "c:\documents and settings\username\my documents\" etc. and see if that solves the problem. The strange thing is though, I wouldn't imagine the error you described if this was the problem, since I wouldn't have thought this could have caused an "object reference" error.
__________________
I don't suffer from insanity, I enjoy every minute of it.
http://www.tib-studios.co.uk
Reply With Quote
  #24  
Old 10-01-2007, 03:37 PM
Iceplug's Avatar
IceplugMaking a tile map but ran into a error Iceplug is offline
MetaCenturion

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

Try loading it into a bitmap object

TempBmp = New Bitmap("tiles\1.jpg")

And test if there is actually a value in this TempBmp
If TempBmp Is Nothing Then
MessageBox.Show("I found your problem.")
Else
MessageBox.Show("This part is fine.")
End If

If you don't get the messagebox, then the code isn't running.
__________________

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
  #25  
Old 10-01-2007, 04:35 PM
Dekaras Dekaras is offline
Freshman
 
Join Date: Apr 2007
Posts: 28
Default

The "This part is fine." messagebox showed

I commented out the tilemap and inserted in this:
Code:
Dim TempBmp As Bitmap
TempBmp = New Bitmap("tiles\1.jpg")
If TempBmp Is Nothing Then
MessageBox.Show("I found your problem.")
Else
MessageBox.Show("This part is fine.")
End If
Into the Form_Load.
Reply With Quote
  #26  
Old 10-07-2007, 01:28 PM
Iceplug's Avatar
IceplugMaking a tile map but ran into a error Iceplug is offline
MetaCenturion

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

ReDim Tiles(NumColumns, NumRows)
did you try:
Tiles = New Bitmap(NumColumns, NumRows)

Also, I think it's best to store a 2D array of numbers instead of a 2D array of bitmaps.
__________________

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
  #27  
Old 10-09-2007, 12:22 AM
Dekaras Dekaras is offline
Freshman
 
Join Date: Apr 2007
Posts: 28
Default

Doesn't work
I appreciate everyone who has helped but it's so weird because the code worked for cags and my file paths are correct.
I just don't see what's wrong and what can be done.
I think I will give up on this mystery and start from scratch again.
Maybe doing it in c++ this time.

So once again, Thanks to all and all the effort you put into helping me.
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
Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error Making a tile map but ran into a error
Making a tile map but ran into a error
Making a tile map but ran into a error
 
Making a tile map but ran into a error
Making a tile map but ran into a error
 
-->