|
-
Dec 4th, 2000, 10:19 AM
#1
Thread Starter
New Member
This is what i would like to do...
-i have the graphics blocks 16x16 pixel Gif files
160 different pieces
-the gamearea or the terrain is in a file.
Starting from 38618 and ending 42618,
So it is 4000 values of size.
- So first i open the file as binary
- second i want to Get an array of 4000 values. as stated
above
Q u e s t i o n :
How to: get the array in any tyoe of values, that are easy to convert to hex values ?
How to: Show it on a form in an editable way ?
50 Rows and 80 Columns
I'm really a novice in vb programming but i (think) i know
quite clearly that this is the way to start to do my Game-area-editor ; )
Please help me
Simo Salosara
-
Dec 4th, 2000, 10:44 AM
#2
Frenzied Member
What do you mean by easy to convert to hex? you can get the hex of every integer as string.
Show them in an editable way:
I normaly use a picturebox and I blt smaller versions of those bitmaps on there. Then just put some code on the mouse down event of the picturebox something like
map(x/tilewidth,y/tileheight) = edittile
that sets the value of "edittile" to the array.
this works if you store your map in an 2d array, but you coul also use a normal array for this.
write me an email if you are interested in one of my mapeditors.
Sanity is a full time job
Puh das war harter Stoff!
-
Dec 4th, 2000, 10:58 AM
#3
Thread Starter
New Member
Ok Maybe i have to ask just the specific Question, so you wont think i can infact do it already.
Forget the stuff on the earlier post : )
1.How to use the Get statement to get an array of (i.e) 40
values
Get #1 38618, values 'returns the first value
'in this case 33
2.How to show the values in hex
(yes i have been studying the help files...)
Thanks again for your reply!
-
Dec 4th, 2000, 11:17 AM
#4
Frenzied Member
That makes it easier for me.
When I understand you right, all you need is hex(number) to get a string with the hex of a number in there. Is this what you want? (probably not)
As far as I know, you can't just read an array. I alsways out it into a loop to get every singe value. I know that is slow, but in my applications that was always good enough.
If this isn't good enough for you, you could try something like loading it to a string. Than what you do is get the pointer of your array and the string and use copymemory to copy the data of the string to the array. I think that should work, but I can't give you code.
Sanity is a full time job
Puh das war harter Stoff!
-
Dec 4th, 2000, 11:38 AM
#5
Thread Starter
New Member
OK! Thanks
so if i use a loop to
get the values individually to a string,
How will i do it ? with Do while...
or with For... Next...
And how to stop the loop when (for example) 40 values have been read ?
And is it the Get statement that i use ?
-please don't get bored of me 
Thanks again
-
Dec 4th, 2000, 04:43 PM
#6
transcendental analytic
Misan! Great news for you, you can read an array, and it's tons faster than to loop. 
Salora, what type of array do you need to read? A fixed length datatype should be easy
Code:
Get #1,38618,yourArray
Non fixed, like variable length strings and some UDT's need to be prebuffered.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 4th, 2000, 08:42 PM
#7
Frenzied Member
So I just can read everything from my array? My array is 2d?
And How do I save this? I couldn't just save the array!
What is going on here??
Sanity is a full time job
Puh das war harter Stoff!
-
Dec 4th, 2000, 08:58 PM
#8
transcendental analytic
Yes you can save any array in any dimensions 
PUT#filenumber,location,arrayname
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 4th, 2000, 09:18 PM
#9
Thread Starter
New Member
Ok Kedaman gave this line a few posts back:
Get #1,38618,yourArray
and it's about the same as what i have been trying.
Dim rivi1(1 To 4000) As Byte
Get #1, 38619, rivi1
but this seems to return only the value that's in
38619 !! (it's the first of the 4000 values.)
What am i doing wrong??
-
Dec 4th, 2000, 09:43 PM
#10
transcendental analytic
That should work, btw you have to open in binary, not random, if thats what youre doing? "rivi" sounds finnish, oletko suomalainen?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 4th, 2000, 10:12 PM
#11
Thread Starter
New Member
-
Dec 4th, 2000, 11:14 PM
#12
transcendental analytic
on ehkä silti parempi kirjottaa englantia, jos jollain olis tähän asiaan jotain sanottavaa vielä
hehe, niin pitäisi, muuten misan ja muut eivät tajuaisi mitään 
Well misan, you could try figuring out what that was all about, hehe. Strings in vb are unicode by default so by converting a byte array to a string just using string=bytarray won't make it unicode.
The solution is strconv:
Code:
text1=strconv(rivi1,vbunicode)
'instead of
text1=rivi1
that should work
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 5th, 2000, 10:23 AM
#13
Thread Starter
New Member
OK ! Kiitos jälleen !
That seems to work!
Now i'm still thinking how to let the user edit the values.
now i get a screen full of weird ASCII-codes and if i wanted to replace let's say this character:
" :ASCII = 34 :decimal = 22 :hex
with this
! :ASCII = 33 :decimal = 21 :hex
what do i call them in the code ?
Can the unicode number ( !=33) be used ?
let's say if i want to assign a terve.gif picture to unicodevalue 33
for example if we have a line of four codes
33 12 55 23
I could present 4 different Gif files in a row according to the values.
(as i wrote in the first post, this is going to be a Game/Terrain editor)
Kedamanille sellaiset terveiset, että jos tuosta englannista ei saa selvyyttä, niin kysy pois ... 
Tämä alkaa kyllä tästä hahmottumaan!
Simo Salosara
-
Dec 5th, 2000, 10:42 AM
#14
Frenzied Member
Hey you guys. Probably you have seen the "I want a muscian" thread. I was talking German in there with some others. Even though we talked English again, they deleted our thread!
Sanity is a full time job
Puh das war harter Stoff!
-
Dec 5th, 2000, 02:41 PM
#15
Thread Starter
New Member
Thanks Kedaman, that was useful info also!
Now i have done a total of 50 strings of unicode of the
game area and i'm trying to enter the next phase of this project.
So i have now on the gamearea 160 different unicodes and
the next thing is that i must do a form where i make
graphical display of this information.
For example if the top row would be all "water", all 80 values. then the program should read the walues and check what they are.
For example the first value on the first row could be 31
and it would mean that on the upper left corner, the first
16x16 pixel graphicalblock would be 31.gif
Is a loop of some sort be a best way to go ??
What is the best way to do this kind of thing,
when i have the 160 GIF files on the disk separately ?
-
Dec 5th, 2000, 02:49 PM
#16
transcendental analytic
Well, i've been developing this kind of game some years ago, i suggest you could have a look at Fox programming site, he has the link on his signature There's a great demo on how you can blit terrains with bitblt Api.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 7th, 2000, 11:49 AM
#17
Thread Starter
New Member
Hello again !
i managed to get the info to the MSFlexGrid
and i was wondering
how to use the: Cellpicture
is it possible to make the what picture to load, depended
on the value in the cell ?
for example: if the value in the first cell is 33
then the program would add C:\33.BMP to the first cell ?
(as i read from the help, both can exist in the same cell at the same time.)
i also found that i couldn't change the values in the flexgrid while the program is running, what i'm doing wrong?
By the way, if you think i'm really going the wrong way with this, just tell me if this Flexgrid/cellpicture is no good!
Simo Salosara
-
Dec 7th, 2000, 09:02 PM
#18
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|