VS 2010 Snake Length Wont Increase?

Aug 15, 2011

I have a problem with snake game. I never tried to make a game with VB, but now i tried to make snake from this tutorial:So i added food to this snake game, and when i taking food, it increases score, but length cannot be increased and i don't know why. This code is in timer to check if snake head is on the food:

If p(m).X = food.Location.X And p(m).Y = food.Location.Y Then
score += 25
food.Visible = False

[code]....

View 9 Replies


ADVERTISEMENT

Code An 'increase' Button To Prompt A User To Input A Rate By Which To Increase Select Prices In An Array?

Feb 16, 2009

I'm trying to code an 'increase' button to prompt a user to input a rate by which to increase select prices in an array.It should request the increased rate, then request a number from one to five, representing which price in the array to increase.Then, if 'increase' button is selected again and another number from one to five is chosen, then that element should be increased.It's working, but all the numbers in the array are changed. And, when I hit the increase button again, the array is repopulated below the first price increases instead of only replacing the designated price.

'declare 5 element array of prices
Dim prices() As Double = {12.2, 8.5, 12, 50, 2.4}
Dim rateIncrease As Decimal
Dim isConverted As Boolean

[code].....

View 1 Replies

VS 2010 Button To Increase Variables

Dec 27, 2010

Still working on that overlay. I am stumped on what I think is my last function. I have a + and a - button that needs to control a text box that has numbers in it. For instance: TextBox1 shows the number 2 in it. When I click the + button I want it to increase that number by 1. It sounds too simple when I say this out loud, but I think I am stumped with this basic function. I don't know where to begin.

View 8 Replies

Vs 2010 Increase An Alphanumeric String?

Apr 10, 2012

i've stored in a file a counter I need in the application, how can I increase an alphanumeric string,

exp:
AAAA
AAAB
AAAC

[code].....

View 8 Replies

VS 2010 Panel Number Increase ?

Feb 25, 2012

I have a problem..So how can i increase panel number?

For example:
for i=1 to 4
Panel(i).handle
next i

But if i do as in example i have error.

View 2 Replies

VS 2010 : ID Should Increase Automatically When New Record Added

Sep 10, 2011

When new record is added, I want the vb to look at the last record in the database, look at its id, add 1 to it (+1) and generate a new number and display it in the IDTextBox.

View 5 Replies

Increase The Size Of The List Box As I Increase The Size Of The Panel?

Feb 25, 2010

I have added a Split container onto my Form and within bottom Panel I have added a list box.How can I increase the size of the list box as I increase the size of the panel?

View 3 Replies

Substring - Error: Index And Length Must Refer To A Location Within The String. Parameter Name: Length

Apr 17, 2009

this is not working?

[Code]...

End WhileI am trying to read from the ": " to the end of the line. I keep getting this error: Index and length must refer to a location within the string. Parameter name: length

View 3 Replies

Index And Length Must Refer To A Location Within The String. Parameter Name: Length Exception

Feb 17, 2011

am getting the above exception while swaping Items in the list(lstRoutePriority).PFB my code

if (lstRoutePriority.SelectedIndex > 0)
{
//Swap the two items

[Code].....

View 2 Replies

Game Of Snake & Ladder. Vb?

Feb 17, 2009

[URL].. to helping me in this game >>> plzi want some changes in that game >>* set the game as full screen .. not only form ..* change automatic moving to maneul...after throw a nurd, and change the players command colour for from defult"gray" to red and blue ...ect.* add textbox or lable or masgbox to add Questions "i've it"... as hiddenwhen nurd stop set as shown and the Questions change every time with nurd

View 2 Replies

Make A Snake Move?

Apr 2, 2009

Okay i only need to know how in the world do you make the snake move towards one direction at the beginning?

View 7 Replies

VS 2010 - How To Find Out Length Of Array

May 31, 2010

I have an array in my application and I don't know how many values there will be in the array because it gets the data from a webpage. Filling the array with information from the webpage works except for the length, it always returns 999. This is my
dim Array() as string
Array = GBA(source, "<b>", "</b>")
Count = Ubound(Array)
How can I find out the length of my array?

View 8 Replies

VS 2010 - String Length No Longer Available

Jul 17, 2011

I have an API that loads into memory from a button click. It can then either load an approx 10MB txt file (ASCII comma delimited characters/decimal list as a string) or live timed data from the internet. The idea is to be able to view the data in a text box. From there I can see what I am doing as far as spitting that info into a datagridview or database. The data is completely out of order in the txt file but has various Getinfo Functions / DLL's accessed via button clicks that split the data into its correct format to display in the text box. The problem I am having is not having fixed length strings in VB 2010. I don't know enough to work out if there is a simple work around or something more complicated required. Everything I have tried has left the textbox empty.

VB 2005 code that works:
Option Strict Off - I want to solve with this ON
Option Explicit On - I want to solve with this ON
Imports VB = Microsoft.VisualBasic
Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As
[Code] ....

View 13 Replies

VS 2010 Graphics.DrawCurve Length?

May 3, 2010

I am pretty sure that my questions will soon get so annoying you won't answer them, but before it happens.I am using DrawCurve (with density set to default) to draw on my picturebox. I need to know the exact length (well, not *exact* but knowing it is around +/- 1px from exact length would be nice) of the curve drawn.

Is there any function in API I could use to get what I want? If not, could you point me to the algorithm (preferably implemented in any language) that I could use with array of points as an input and length as an output value?

View 13 Replies

VS 2010 Length Of The String In Pixels?

Feb 3, 2012

I have a title (in one line) that can have different lengths. I need to print this title on A4 landscape - page ( draw string in print page event), but always it should be located in the middle of the page, regardless of length. If I want to determine the exact location I have to calculate the length of the string in pixels. Or maybe there is a better way to center the string on page? How can I do it?

View 2 Replies

VS 2010 Null And Zero Length Strings?

Mar 14, 2011

This is related to my last question.Even though Access considers Nulls and zero-length strings (ZLS) separate values, often developers wish to treat them as equivalent for the sake of an If...Then statement or some other stretch of code. One way to accomplish this is to write code like this:

' Not so efficient
If IsNull(varAge) or varAge = "" Then
' do something

[code].....

View 4 Replies

Project For School (snake Game)

Dec 6, 2010

Iam doing a project for school (snake game) Ok here is the code:

[CODE]:................

Snake.image is the head of snake and snake2.image to snake27.image are the rest(body...) So i want create a code that (if snake intersect snake2 to snake27 parts) then timer1.stop I have tryed with:

CODE:

But it doesnt work..

View 6 Replies

.NET Snake Game Freeze When Hold A Key Down?

Dec 24, 2011

I'm trying to make the classic Snake game in VB.NET, but if I hold a key (any key) during the game, after a few seconds the game freezes until I release the key. I've tried lots to fix this, but nothing works, maybe because I don't understand the problem.I'm assuming that when I hold down a key, the Form1_KeyDown function gets called, and when, after a few seconds, the key goes into "I'm being held down" mode, that function is constantly called, so the timers don't get a chance to update. But like I said, I'm probably wrong.

I've been struggling with this for a while. I think this is all the necessary code, please let me know if it isn't.

[Code]...

View 3 Replies

Process Of Making A Snake Game Using .NET?

Jul 23, 2010

I am currently in the process of making a snake game using VB.NET... I was just wanting to gather ideas on how to do the body of the snake..Currently I have a class called SnakeBody which contains the following code:

[Code]...

I guess what I am asking is if Dim body As PictureBox a logical thing to put in my class. As in, I am not sure if that is the correct thing to do? To create the actual body of the snake I will have an array of these SnakeBody objects. If `'Dim body As PictureBox is valid How do I reproduce the same picturebox everytime my snake eats something?

View 2 Replies

Red Block Making Not Working-Snake?

Mar 11, 2009

I am currently working on a snake game. I am trying to make a red block appear every time you eat food a red block appears. If you hit the red block, you die. For some reason, food works, but the red blocks never appear

View 6 Replies

Snake Game Food-Making?

Mar 3, 2009

I just started a snake game. This is what I have so far:

View 2 Replies

Snake Game Freeze When Hold A Key Down?

Apr 8, 2012

I'm trying to make the classic Snake game in VB.NET, but if I hold a key (any key) during the game, after a few seconds the game freezes until I release the key. I've tried lots to fix this, but nothing works, maybe because I don't understand the problem.'m assuming that when I hold down a key, the Form1_KeyDown function gets called, and when, after a few seconds, the key goes into "I'm being held down" mode, that function is constantly called, so the timers don't get a chance to update.

View 10 Replies

Convert Character Length To Pixel Length?

Jan 6, 2010

I have a field displaying on a datagrid that the user has asked to be variable length based on the data that is returned. Is there an easy way to determine how many characters are returned for a field and then converting that to a pixel length so that I can change the length of the field in the code.

View 2 Replies

Fixed Length File Into Access 2010?

May 2, 2012

i am trying to import a fixed length text file into an access database (accdb). I already have the table created but it doesn't have to be that way. i am wondering if i know the field lengths, can i a use a SELECT INTO query to get the data into access. or do i need a schema file?

View 1 Replies

VS 2010 Get Double Fractional Part Length

Nov 20, 2011

I am creating a math related class and one of the problems I have been having was how to create a function to return the fractional part of a double as an integer. I could easily do that if there was a way I could get the length of the digits.

-3.141 should return 3
-0.125 should return 3
-0.5 should return 1
-0.4545 should return 4

I would like to do this without using string manipulation. So far all I have gotten on the web is unanswered questions. I thought of using log, but it doesn't give the desired result when working with numbers < 0

View 3 Replies

VS 2010 String.Length() Returns Null

Jun 11, 2011

[Code]...

By my logic, this should only assign .length to index IF the length of strItem is longer than 0. This check is there in case the listbox is empty, or the user has not selected an item. However, everytime I go through this code without an item selected I get:

[Code]...

View 4 Replies

VS 2010 Variable Length Rows In Table?

Dec 26, 2011

I am wanting to create 2 tables called Stores and Locations. Locations is a table containing a unique location_code and a location. Stores is a table containing a unique store_code a store name and a variable number of location_code's and a relationship is set up between the 2 tables.

creating the Stores table in particular the location_ code. Can rows in a table have differing numbers of columns? as a particular store type could be in many diferent locations. I feel it should be possible to set up some sort of array of Location_code's in the Stores table.

View 2 Replies

Drawing Grid - Moving Snake To Square?

Apr 7, 2009

I am setting up a snake game, I just like to know a few things. Do I require a GRID? and the grid needs to be the same size as the square obviously but how do you go about moving the snake to the square. I mean why do I even require a grid? Why cant I move the snake by its own size. Just need some clarification of the steps I should take to make my snake game. I would like to do this from scratch.

View 2 Replies

VB Snake Game Troubles With Array And Growing?

May 26, 2010

im making a game for my assignment of snake. Vb10 Im coding 90% by teaching myself. Was just wondering if anyone has any idea how to help me. Im stuck with the array for making new pictureboxes and moving them to extend the snake here i some of the code.

Private
SnakeHead.Left = SnakeHead.Left + xDifference
SnakeHead.Top = SnakeHead.Top + yDifference
If SnakeBody(1).Left <> SnakeHead.Left And
SnakeBody(1).Top <> SnakeHead.Top Then

[Code]...

View 13 Replies

VS 2010 Array Count Characters In Unknown Name Length?

Feb 6, 2012

I need to seperate a name into 2 parts using split the first part being 2 letters "That was easy" but the last part of the name would have an unknown lenght. so how do I get the unknown length? I believe I understand the Join Part here is what I have but it only works when you know the lenght of the name

Project Notes
'Form has two textboxes and one button
'first text box holds a first and last name
' 1-seperate the first and last name into 2 variables

[code]....

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved