array bitmaps? :confused:
-
I am making a game with tiles and when i draw the map i draw the tiles one by one, after one is drawn, it makes the next, in the next location, so theres just one image changing locations and images(form a string). i need it to keep the other ones there and draw the next one. i think i want to do this with an array but im not shure. what should i do? ---------------------------------------------------------- dim tile as string ---------------------------------------------- in the map load sub: do if textbox=1 then tile=(location of picture) end if if textbox=2 then tile =(location of pic.) end if ------------------------------------------------------- in the form1 paint sub: e.graphics.drawimage(new bitmap(tile)tilept.x, tilept.y) ---------------------------------------------------------- :confused: thanks for your time
-
I am making a game with tiles and when i draw the map i draw the tiles one by one, after one is drawn, it makes the next, in the next location, so theres just one image changing locations and images(form a string). i need it to keep the other ones there and draw the next one. i think i want to do this with an array but im not shure. what should i do? ---------------------------------------------------------- dim tile as string ---------------------------------------------- in the map load sub: do if textbox=1 then tile=(location of picture) end if if textbox=2 then tile =(location of pic.) end if ------------------------------------------------------- in the form1 paint sub: e.graphics.drawimage(new bitmap(tile)tilept.x, tilept.y) ---------------------------------------------------------- :confused: thanks for your time
I am no expext, but I do know that if you are going to do an array you have do dim your tile a little diffently and you problably will need a timmer. First off I am interested in knowing if you are a student. Because I don't want to ruin ones learning experiance by giveing away to much code and then it is just copied into a form to get the grade. But I will try to get you going on it. Dim tile() As string '''I probably would use pictureBox Also you will either have to put the number of how many images in the (21) Or you will have to figure out a way to count of them and Redim them later. Here is an example of how an array works. But will not help you for images,unless you can figure out how to convert the code to suit your needs. Dim student() As String 'student is the array Dim intCount As Integer ''intCount is the counter If IO.File.Exists("A:grades.txt") Then 'This is used to check to see if a file exist.Not sure how that would be done for images. my = IO.File.OpenText("A:grades.txt") Do While my.Peek <> -1 ''This reads it to the end.. student = my.ReadLine ''Stores the data from a line in student intCount += 1 ''keeps count of how many times it is done. Loop ''repeats the process untill the end of the file has been reached. Btw the end of the file is identified by -1 Now you have to redim the the student to so you know how big the array is. ReDim student(intCount) my.Close() ''Always close any file readers. But in your case I think you are looking for something more like this. #Region " Windows Form Designer generated code " #End Region Dim bulb(47) As PictureBox Dim a As Integer Private Sub btnLights_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLights.Click Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick bulb(1) = PictureBox1 Repeat this process for the amount of the images you use. Also you must have a main pictureBox. Mine was a christmas tree. The Bulbs are little bitmaps made in paint. The next process makes them blink. For a = 1 To 47 bulb(a).Visible = Not bulb(a).Visible Next These are just sniplets of code so they probably won't work without putting some thought into them. But doing this will make you learn it better than just given the code away. Also if I have explain
-
I am no expext, but I do know that if you are going to do an array you have do dim your tile a little diffently and you problably will need a timmer. First off I am interested in knowing if you are a student. Because I don't want to ruin ones learning experiance by giveing away to much code and then it is just copied into a form to get the grade. But I will try to get you going on it. Dim tile() As string '''I probably would use pictureBox Also you will either have to put the number of how many images in the (21) Or you will have to figure out a way to count of them and Redim them later. Here is an example of how an array works. But will not help you for images,unless you can figure out how to convert the code to suit your needs. Dim student() As String 'student is the array Dim intCount As Integer ''intCount is the counter If IO.File.Exists("A:grades.txt") Then 'This is used to check to see if a file exist.Not sure how that would be done for images. my = IO.File.OpenText("A:grades.txt") Do While my.Peek <> -1 ''This reads it to the end.. student = my.ReadLine ''Stores the data from a line in student intCount += 1 ''keeps count of how many times it is done. Loop ''repeats the process untill the end of the file has been reached. Btw the end of the file is identified by -1 Now you have to redim the the student to so you know how big the array is. ReDim student(intCount) my.Close() ''Always close any file readers. But in your case I think you are looking for something more like this. #Region " Windows Form Designer generated code " #End Region Dim bulb(47) As PictureBox Dim a As Integer Private Sub btnLights_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLights.Click Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick bulb(1) = PictureBox1 Repeat this process for the amount of the images you use. Also you must have a main pictureBox. Mine was a christmas tree. The Bulbs are little bitmaps made in paint. The next process makes them blink. For a = 1 To 47 bulb(a).Visible = Not bulb(a).Visible Next These are just sniplets of code so they probably won't work without putting some thought into them. But doing this will make you learn it better than just given the code away. Also if I have explain
hey, thanks for your help but im not shure what your saying. I'm a student but In high school, so Im not trying to cheet lol. Im sorry for not saying this but I'm not using picture boxes but bitmaps. I'll email you the code so you can see what I mean, If you dont want to download it then I will post the code later, my email is: p_dog_2007@hotmail.com thank you, if you dont have the time i can wait