VS 02 / 03 Checking ".Left" Of Whole Object [Space Invaders]
May 20, 2009
What I mean by "Checking ".left" of whole object" is making something happen if, for instance, a label were to hit an object. Instead of it needing to hit at the objects exact left, it could hit anywhere on the object. Bit confusing...I know...here is an example...
[Code]...
View 5 Replies
ADVERTISEMENT
Dec 2, 2009
Im creating a space invaders game that has a group of "invaders" moving side to side and when i shoot one it gets destroyed, my invaders are in an array. So in order for the invaders to keep moving right until they get to the edge, i made a function that detects which invader is right most. But this was crudly done as I wa trying to make the opposite of my left most function which works. So my rightmost function dosent work
[Code]...
View 19 Replies
Oct 15, 2011
I've got everything working except this one problem which I can't seem to get my head around.I've made a function that returns a random number between 1 and 11 (how many invaders there are on a row).I've managed to get this to work, however the invaders will keep firing even if they are visible, so I made a do until loop which says to keep running the random number until it finds an invader which is visible... The problem is that if the whole row of invaders aren't visible, it will get stuck in the loop.
View 13 Replies
Apr 10, 2009
I'm trying to make a space invaders rip off, and I'm currently stuck on how to make the missile fire from the center of the player's ship. I have the missiles all in a control array, and they move up the screen fine, they just dont start at the x point of the ship, they start on the left margin.
Dim Line As Integer
If Missile(0).Location.Y < 391 Then
Missile(0).Location = New System.Drawing.Point(Line, Missile(0).Location.Y - 5)
[CODE]...
View 8 Replies
Mar 17, 2011
I want to make a simple 2d game in Silverlight, but it seems like things have changed since the last time I tried to make a game using mode 13h graphics. Can someone give me a run-down of how you'd go about it.I just mean at a high-level, focusing on the silverlight-specific aspects; not general game design.A fictional example might be:'The main game loop shouldn't be a loop, use a DispatchTimer instead. Use a Canvas as the main drawing object; but realize that we don't bother drawing individual pixels - all of your in-game objects should be represented by controls. Be sure to set the 'UseHardwareFlag' to true'.
View 1 Replies
Oct 2, 2008
i'm not very familiar with GDI+, but i managed to create some basic functions of Space Invaders game i try to develop in Compact Framework. I have problems drawing the images (Spaceship, bullets, enemies). The screen is flashing a lot. I use a buffer bitmap in which i draw images to the new positions, and i have 1 line of code that just draws the buffer to screen
[Code]...
i use me.Invalidate inside a timer so every 50msec the game redraw the screen with new positions. Why the buffering does not work?? It can't be the emulator that i preview the program, it is flashing A LOT. Is there any similar code / project that could help me? i'm tring to find a similar project for COMPACT FRAMEWORK but i only find C++ .net examples. i need VB .NET COMPACT FRAMEWORK examples
View 2 Replies
Oct 2, 2011
Been given an assignment to create a space invaders game. Although there's a long way around, is there a way to make my code smarter.Here's the section to make a row of invaders so far:
Public Class Form1
'number of invaders in a row (horizontal)
Dim numberofinvaders As Integer = 11
'set of invaders (vertical)
[code]....
So what I want to do more precisely is have the value of setofinvaders to change how many rows of invaders vertically in a loop.
View 13 Replies
May 9, 2009
So I basically want to make sure that a string entered by the user is valid. Valid being over 10 characters, containing only upper case characters, and only characters A - Z and spaces. The first two were easy, but I'm having trouble with the third, though.What I originally attempted to do was create a loop which checks if the first invalid character is present with the InStr function, by using the characters ASCII value. The next ASCII value is then checked, and so on until it has checked the string for every single invalid character. If an invalid character gets picked up, 1 is added to a variable, and after the loop is finished executing, if the variable is no longer 0, invalid characters have been detected.
View 3 Replies
Sep 8, 2011
I am wondering if anyone has any idea how to make the controls stack and fill up the available space left by a control if the control is hidden or removed from the UltraGridBagLayoutPanel.
Example:
[Textbox 1]
[Textbox 2]
[Textbox 3]
[Textbox 4]
[Textbox 5]
If I hide [Textbox 3] as of now, it will disperse the space left equally and pad the remaining text boxes with the space. However, I would like it to do this...
[Textbox 1]
[Textbox 2]
[Textbox 4]
[Textbox 5]
Where all the text boxes will move up and [Textbox 4] will completely consume the space left by [Textbox 3].
View 1 Replies
Jan 12, 2011
In the Session_Start of the Global.asax i have
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Session("login") = False
[code]....
Why i am getting error the error Object reference not set to an instance of an object. at line
If Current.Session("login") Is Nothing Then
while checking for the login state as follows?
If GetLogin = False Then
'Do something
End if
I mean i have already created the instance on the Session_Start... Haven't i?
View 1 Replies
Sep 25, 2011
How would i get a certain text inside a textbox to equal that text space to space or null to space?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Textbox1.Text.StartsWith(Textbox2.Text + " ") And Not String.IsNullOrEmpty(Textbox2.Text) Then
Textbox1.Text = Textbox1.Text.Remove(0, Textbox2.TextLength)
Textbox3.AppendText("a")
End If
Btw: after i finish this step my project will be finished!
View 4 Replies
Sep 29, 2009
In my application i have set a reference to an activeX component that has been written in vb6(that's not important) What i have done is Here (woo my first hyperlink i hope it works lol) But this is neither here nor there, what i would like to do is put a check to see if the object that has been assigned the activeX component has been assigned it. What i can think of is:If myObject Is Not Nothing Then'set some other stuff End If
The only trouble is, obviously i have an error. Over the Not Nothing I have the following error: 'Is' requires operands that have reference types, but this operand has the value type 'Integer'.Is the type 'Integer' at the end there refering to the Nothing being an integer -1 or 0 and i'm not sure how i would reference the type active x.my question: How can i check if the activeX component is an activeX component and not a whisp of thin air/nothing.
View 6 Replies
Apr 1, 2011
how i can disable completely mouse and keyboard input on a WebBrowser object using Visual Basic 2008 i have this code:
Dim CarImp
As
New DirectoryInfo("C:VSEPRN")
If CarImp.Exists =
[code]....
i generate a small HTML file on a hard disk, put the AxWebBrowser2 object navigate to the file, all works fine, but i need to diable all user interface on that object. If the user clicks on object, the page reloads completely and i need to avoid that behavior.
View 2 Replies
Apr 15, 2011
how find an object's type when it is a subclass of another object and I only know the string value of the object's type's name.
I created the follwing classes:
Public Class word
End Class
Public Class noun
[Code]...
Using 'TypeOf', I correctly see that pn is a properNoun, a noun and a word. The problem is, using 'GetType' to check pn against a string value, I can only see that pn is a properNoun, not that its parent classes are noun and word.
Is there a way to check pn against the string value "noun" or "word" and get back a positive result, indicating that pn is indeed a noun and a word as well as a properNoun?
View 2 Replies
Mar 7, 2012
I have a hashset (of posdata), pos data containing a boolean and a label containing the hashkey. I need to draw up a condtion where it will check that if a boolean for two or three different records does not equal to false. And if the condition is true i want to set the boolean of the two or three records to false. Here is an attempt,
ElseIf (position.strLabel = "b2" And position.blnAvail <> False) And (position.strLabel = "b1" And position.blnAvail <> False) And (position.strLabel = "e1" And position.blnAvail <> False) Then
[Code]....
View 1 Replies
Apr 15, 2011
I'm trying to figure out how find an object's type when it is a subclass of another object and I only know the string value of the object's type's name.I created the follwing classes:
HTML
Public Class word
End Class
Public Class noun[code]....
The problem is, using 'GetType' to check pn against a string value, I can only see that pn is a properNoun, not that its parent classes are noun and word.Is there a way to check pn against the string value "noun" or "word" and get back a positive result, indicating that pn is indeed a noun and a word as well as a properNoun?
View 2 Replies
Jan 10, 2010
i am currently trying to make an invaders-like game with visual basic 2010.I've managed to make one alien (picturebox16) dissapear when the coordinates of the arrow (picturebox1) kinda matches the coordinates of the 16th alien, however, the second alien(above it) doesnt dissapear(picturebox4)?
View 2 Replies
Mar 28, 2009
I'm using vb2008 Is that possible to change the pointer from left to right to right to left in the TextBox.
View 4 Replies
Oct 28, 2011
Is that possible to change the pointer from left to right to right to left in the TextBox. to became as it show in the pic below.
View 2 Replies
Oct 8, 2011
I am trying to figure out how to make a .SubString get the characters from right to left not left to right.Say if a user enters 123456789 in text box 1 and I use textbox1.text.SubString(0,2) it will display 12. But, I want it to get 89.I do not want it to get 98, but 89. I tried textbox.text.substring (0, -2) but that just gives an error.So if Gold is entered it gets ld
Fun
it gets un
VisualBasic
it gets ic
View 5 Replies
Jun 6, 2011
I got a panel that i am adding labels to. I have autoscroll enabled on it so when they fill the viewable space it scrolls. but i need to put the labels to the left unviewable space(when left scroll is already at 0) The label is placed but i dont get the scroll bars and i cant force it to scroll to a - value.
Is this even possible? Same thing with UP.
Or is the Scroll only limited to Bottom and Right?
View 3 Replies
Sep 8, 2011
I am using a picture box. I want to be able to use the Space or Enter key to change the image in it. For that, I try to use the keydown function as follow:
Private Sub ChestWindow_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.NumPad1[code]....
is the function which changes the image. It works well when I press '1' on my numeric part of the keyboard as a test.The issue is that when I press Space or Enter, the form containing the picturebox closes. (I've already put the keyPreview property to True)
View 13 Replies
Aug 4, 2010
Is there any better performance by checking for a true value like this:
[CODE]..............
Than like this:
[CODE]..............
View 5 Replies
Jul 10, 2010
I am somewhat new to object oriented programming and am attempting to flatten a Linq object hierarchy by using a shim class.how to initalize a derived class with property values from a base class?I have two objects, a base object with about 100 properties, and a derived object which inherits from the base object and adds a few additional properties beyond those of the base object. My simple constructor creates the derived object, but I am looking for a way to initialize the derived object properties with values from the base object.Right now I am using reflection to iterate over the properties individually and I suspect there may be a better way. The following example shows my shim class constructor for the derived class, and two properties:
newProperty1 - a new string property of the derived class
flattenedProperty2 - a new string property of the derived class, copied from a 2nd-level object of the base class
Code example:
Public Class derivedObj
Inherits baseObj
Private _newProperty1 As String[code].......
Is this the correct constructor approach to flatten the object hierarchy using a shim class? My second question relates to initialization of properties in the derived class. The constructor above creates the derived object, but what is the best way to initialize the derived object properties with values from the base object? The following code uses reflection to iterate over the properties individually, but I suspect there may be a better way.
Code example:
' property names are in the string array fieldNames
'baseObjQuery is an ienumerable of baseObj
'derivedObjList is a list of derivedObj[code].....
Is there a simple way to initialize values for the properties in the derived object based upon the values of the common properties in the base object?
View 7 Replies
Feb 25, 2010
i have a requirement that my <xsd:string> should allow space.it should not validate the space. but naturally it will not allow space. but i need it should allow space.
View 1 Replies
Jul 21, 2010
i want to add a space every 5 characters of a string. My code below able to do that only for those character in the beginning. For those at the back, it never insert the spacing.
[Code]...
View 4 Replies
Jun 9, 2012
I would like to get the width of some text drawn by GDI+ in an Integer so that I can adjust the position of a cursor.
I used:
"lCursor = g.MeasureString(vInputText, Font)"
In which 'lCursor' is the offset for the original location of the cursor. But apparently the output of MeasureString is not integer and can't even parse it to integer.
View 10 Replies
Jan 27, 2010
i tried to create a namespace but its giving error .Warning 5 Namespace or type specified in the Imports 'one' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.i opened a new class file ie class1.vb in that i cretaed namespace.[code...]
View 7 Replies
Mar 4, 2009
1.Are exceptions used to indicate error rather than returning status or error codes.i need to remove the space between 1. and Are.So how could i remove the space? sugestions and samples are most appriciatable.
View 2 Replies
Nov 30, 2006
Almost every one hour, when I run the project
View 12 Replies