Making Sprite Class And Cycling Through Image Arrays
Feb 2, 2012
I am using vb.net by the way. From what I understand, Xna is not usable in visual Basic. Therefore, in order to create my characters, I defined a sprite class. Now my question is.... (I am drawing everything using a timer on the form btw by the process of invalidation.)... how do I use time to cycle through the images in an image array while the instance has no focus, and whilst the class inherits the "Control" class? Basically, how do i get these instances to act without user input? I want a character to eventually respond to user input, but I also need npcs that do not need any input in order to move themselves. Also, I need this in such a way that each instance's processes do NOT interfere with the processes of others. So that whatever timing I use does not also stall the whole window/form.
View 2 Replies
ADVERTISEMENT
May 7, 2010
I need some advice on a game I created. The game bounces a Sprite around a Panel and the user clicks the sprite to catch the sprite What I want to do is introduce a dificulty level easy medium and hard the level puts more sprites in the panel, the higher the dificulty level example
[Code]...
View 2 Replies
May 5, 2012
I am currently making a small flood runner like game, I completed most of it, but I can't seem to get the jump action right. I got it to jump straight up and back down again, but it doesn't work when I use a left/right arrow key with it to perform a left/right jump. The sprite goes straight up if I only press space.What I want- The sprites goes up and right or left when I press space while holding right or left.
View 2 Replies
Feb 17, 2010
I'm using a class which lets me retrieve the a System.Drawing.Image by specifying a Sprite ID... I'm wondeirng, after I get the image, how do I draw it onto the form? Heres what I got so far
Dim img As Image = Util.SpriteReader.GetSpriteImage(3367)
View 4 Replies
Jul 3, 2011
I can't seem to find a way to get the Transparency of the character sprite to work. It always seems to take the background image of the form no matter how I tweak it.
View 15 Replies
Jan 28, 2011
not to use ArrayList for making my arrays in VB.NET. I would like to hear opinions about that, why shouldn't I? What is the best method for creating and manipulating array contents, dimensions etc?
View 3 Replies
Nov 15, 2011
Below you will find a code sample that I have dummied up to try and demonstrate the issue I am having. However, this is just a dummied up piece of code. The actual program has noting to do with STUDENTS or TEACHERS. Basically, the problem I'm having is trying to have a CLASS within another CLASS each of which contain ARRAYS that need to be dynamic in size. The sample has a CLASS called STUDENTS that can have in theory many students, the number of which are unknown to the CLASS. I need to be able to add STUDENTS to the ARRAY programmatically.
The CLASSROOM Class should also be an Array since each TEACHER will have MANY Students. There will be only 1 Teacher for a given classroom but the SCHOOL will have MANY CLASSROOMS. Again, I need to programmatically add Teachers and Students without having predefined Array sizes. The code I have listed below will NOT work but it demonstrates what I am trying to achieve. I want to be able to reference the CLASS by using something like this ...
School(iTeacherIndex).Student(iStudentIndex) = "Rick Smith"
I feel like I should be able to use ARRAYLIST in both classes but haven't been able to get it to work. I've tried DIM'ing as ARRAY and can't get that to work either.If I can get ARRAYLIST to work then I shouldn't need to worry about expanding the array via UBOUND (if it's even possible).The REAL question is "How do I have a CLASS within a CLASS, each of which has ARRAYS that need to be dynamic in nature so they can be expanded as needed? The size of the array cannot be determined ahead of time".
REMEMBER . . . the actual program has nothing to do with Students and Teachers. This was just my way of demonstrating the issue using an analogy that I thought everyone could understand. The actual Class is much more involved.I have purposely hardcoded some values just to make the sample easier to work with. This is NOT how I normally program but is just here to hopefully make things a little more clear.
Here is the sample code . . .
'***********************************************************************************
'***********************************************************************************
'***********************************************************************************
'Here is the code that is in the form - This obviously doesn't work
Private Sub TeacherTestDemo()
Dim iTeacherIndex As Byte
Dim iStudentIndex As Byte
[code]....
View 2 Replies
Mar 15, 2012
I am making a array (unknown value) into a grid for a game of pairs (where you must get both of the cards). So far I have specified the array to a specific size of either 6, 6 10,10 or 16, 16. using a button. The selection is defined from the button as specified before
Dim NumberOfCards(Selection) As Integer
Dim NumberOfCards(Selection) As Integer
Now I have a panel box which I want to add the number of rows / columns as the array sizes which I cannot do. But also add a image specific to all of them.
View 1 Replies
Jul 6, 2010
I'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?
Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)
[code].....
View 5 Replies
Apr 30, 2009
What should the set/get function look like for the following class?[code]...
View 7 Replies
May 22, 2010
This section of code is part of a much larger program.However, I can't seem to find the problem with this error.Error: Object reference not set to an instance of an object.[code]I'm using this array inside of a class form to maintain the memory of a computer player in a rock, paper, scissors game. There are two computer players involved; thus, the need for a unique instance of each array for each player.I'm struggling with this program and all of my errors are gone until I try to run the main form.I can link more code if needed.
View 3 Replies
Feb 14, 2009
I can't figure out why this does not work.
Public arrs(32) As ARR
Public Class ARR
Public nr As Integer
[Code].....
View 2 Replies
Apr 8, 2010
Is it possible for one class to access an array of values within another class as a readonly property of the second class? All of the examples and references on class properties imply that one can only retrieve one value by calling a class' property.
View 2 Replies
Aug 30, 2011
Ive currently got this:
Public Class World
Dim StringA() As String
Property SetString() As String()
Get
[code]....
I need StringA to be a Two-Dimensional Array. I've played around with it and was unable to figure it out..
View 6 Replies
Feb 19, 2009
EDIT: SI have a web service which uses a class of functions in order to return data used in various business processes (via InfoPath). One of the functions takes a given SQLCommand object and executes it into a SQLDataReader. Now depending on the SQL command text used this may return one or many rows of one or many columns. So what is the best class for this function to return bearing in mind it needs to be serialized by the web service.
My existing code is:
Dim array As New ArrayList
Try
[code].....
View 1 Replies
Dec 15, 2011
I have 2 arrays. One is an array of images other an array of numbers. The images are card faces, (Card(i)), the integers are the corresponding values of the cards (Value(i)). I want to associate the card face with a corresponding value. However, everytime I do what I think is correct, I get an error stating that I cant convert an image to an integer and visa versa.
View 6 Replies
Oct 1, 2011
I am trying to use several Class arrays to hold values that I will cycle through at a later point to perform some calculations. I need to change the array sizes to fit the data as it is entered. I am using one procedure to set the first element of each array and then a separate procedure to pass the additional values as they are entered.
Until my last attempt at changing my code, my StartBalance sub seemed to work, I could step through and see the values assigned to the class arrays in the code block. However, when it moved on to the Transaction sub, it did not recognize that the first set of values were set, the array shows zero values for index 1.
I have gone through several changes trying different ideas from reading blogs and articles, but I guess I am not understanding how these work. I even used the class arrays directly instead of the Property procedures to see if I would get a different result, but I do not.
I believe I must be approaching this incorrectly and though I can find dozens of examples of setting class variables and even a couple on using arrays as class variable, I can not find any that show how to then pass values to those arrays.
Public Class Statement
Private _tranDate(1) As Date
Private _amount(1) As Double
[Code]....
View 8 Replies
Jun 14, 2009
I have an app that loads a jpg into a picyure box, then updates exif data in exifworks classThe problem is that when I save the image(from image used for picture box) or class (to save exif data) then try to delete, sometimes I get success, others it won't allow delet I have gone to the trouble of using gc.collect, do events, put the delete in a timer & wait for the delete before continuing & still get the problem
View 7 Replies
Dec 7, 2010
I am making an application which is capable of displaying a picture, and making adjustments to it. Unfortunately i'm stuck at this phase:The colour of each pixel in the image should be inspected and stored in one or more arrays.
My code so far
Public Class Form1
Dim OpenFileDalog1 As New OpenFileDialog
[code]....
View 6 Replies
Mar 10, 2009
I am using visual studio express edition 2008. I am trying to move my class.vb files in my web application to one .dll. I used visual express edition 2005 earlier and I had to add to import the below code to get it to work. Now in 2008 edition I get a whole new error and I need to know what I need to Import. Code is below
2005:
Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Web
When I do the above in 2008 I get the following errors:
Shared mainconnection As
New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("connectionstring").ConnectionString)
Error: Error 1 Name 'ConfigurationManager' is not declared.
[code]....
View 1 Replies
Oct 29, 2007
I was wondering if it was possible to make an array of a class. I made a class called creatures (for a game of course) and wanted to make an array of that class. So I tried "public creature() as new creatures", and it had a problem with using an array with new. Is there a way around this. All I am using the class for is variables. i.e.: in my class all i have is dim health, defense
View 12 Replies
Mar 2, 2009
Making an icon out of an image
View 3 Replies
Sep 4, 2011
I have been practicing, and have created an extremely simple image converter.I want to include some vector formats. The formats that I want to include, but aren't in System.Drawing.Imaging.ImageFormat
are
.ai
.cdr
.dxf
[code]....
How would I go about writing the code, to where they would work? Is there a way to make them recognized?
View 3 Replies
May 2, 2011
I'm making a blackjack game for class. It's been better programming in VB than it has in C#, but I don't know how to link button subs (BTN_Deal_Click or BTN_Deal; I can't decide which one will work) to one another. For example, after the code in BTN_Deal has been run, the program is supposed to wait for the user to click either the Hit or the Stand button.
[Code]...
View 2 Replies
Jun 22, 2010
I haven't quote grasped this whole "class" concept yet, but I'm working on it. When following the instructions below, the "test" portion of this code: "test.variable". It has an underlined error that says that "test" is not declared. If I remove the "test" word then the ".variable" shows not declared. I'm using Visual Studios 8 if that makes any difference. I have a pre-existing variable in a project that I would like to monitor for changes.
Re: Detect variable change.
Make your variable a class with an event.
Make your class:
VB.NET Syntax (Toggle Plain Text)
Public Class myVar
Private mValue As Integer
Public Event VariableChanged(ByVal mvalue As Integer)
[Code] .....
View 1 Replies
Mar 31, 2012
I Use the following code to detect if a sprite should be going up or down and the response
If (pos.Y + 100) >= Sprite.BottomY Then
Going_up = True
pos.Y = Sprite.BottomY - 130
End If
[Code]...
but it's pretty terrible. It only works when the sprite starts at the top, and when I want to change the BottomY and TopY, it just starts glitching. What is a better to detect if the sprite should be going up or down?
View 2 Replies
May 19, 2011
I've created a label that changes text when I click a button. I also want an image to appear under the label after the button is clicked. I added the image with an image control(not sure if this is correct) and I want it invisible until the button is clicked. What Code Behind should I use for th ebutton.
View 3 Replies
Mar 3, 2011
creating a program in VB.NET that can make an image(.img) of a memory card?
View 5 Replies
Oct 15, 2011
I have made picture viewer in VB which also shows all the pics present in a folder as thumbnails using image list and listbox. The problem is whenever the user clicks refresh it takes long time for the image to load. I want to some how make a cache like thing where i can store the image for faster access in the future.
View 2 Replies
Jun 15, 2009
I'm wondering if it would be relatively not so hard to add some algorithms in my code to shrink the size of images?So say I told my program to add all of My Pictures to it, can I shrink it somehow?WinRar does a nice job, how complex is it lol?What exactly is the process of shrinking the images, I don't quite understand it, (or shrinking anything, music, videos, text)
View 3 Replies