Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 1st, 2008, 07:00 AM
Registered User
 
Join Date: Jan 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default how create game snake?

hello, please help me to creat game 'snake' . game should be simple: snake move and eats dots. so please, help me with this game- write game code


thanks..:)

 
Old January 1st, 2008, 01:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

is this homework?? what type of help you need?? what do you have??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old January 1st, 2008, 04:23 PM
Registered User
 
Join Date: Jan 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, this is homework (microsoft visual basic). I don't know how to start it.. I think I could make it with 'dot'.. but I don't know..
help me please...

 
Old January 1st, 2008, 10:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. we don't do homework, but we can help you with anything you want... by 'dot' you refer vb.net?

if this is homework, for sure you have a point to start from.. I mean, you have a porpuose for this project, can you tell us what is?? and also, your ideas???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old January 2nd, 2008, 04:50 PM
Registered User
 
Join Date: Jan 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I want to learn to programme.. now I'm learning with microsoft visual basic (6.0). and I need to creat a simple game 'snake' for my studies for next tuesday.. so, I think at start I need: to keep track of the snake (I mean- coordinates: x and y) then line should be to keep track of the dot (that dot place would be randomly placed..

and what else I need?

 
Old January 2nd, 2008, 09:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. you first need to define a playground, then you can use something like a grid to move on...

for that start, you draw (someway) a snake head, and learn to move it with keys.. you have your start there..

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old January 3rd, 2008, 06:47 AM
Registered User
 
Join Date: Jan 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and how I can to define a playground?

 
Old January 3rd, 2008, 07:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

For playground I mean dimensions, how will it work, bounds...

ask yourself, how will you do it if you have to do it on paper? (and play it on the paper)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old January 3rd, 2008, 11:16 AM
Registered User
 
Join Date: Jan 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think it shhould work.. but.. can you explain me, what's wrong here? I would very appreciate.. :)

Dim blnStop As Boolean 'Flag to stop game when user clicks the Stop Game button
Dim sngYFactor As Single
Dim sngXFactor As Single

Private Sub cmdStart_Click()

   Dim sngX As Single
   Dim sngY As Single
   Dim lngSnakeColor As Long
   Dim lngWasteTime As Long
   Dim lngMySpeed As Long
   Dim intI As Integer

   cmdStart.Enabled = True 'Disable Start Game button
   blnStop = False 'Set Stop flag to false

   lngSnakeColor = vbBlue
   lngMySpeed = 200
   sngX = 100
   sngY = 100
   sngXFactor = 0
   sngYFactor = 1
   AutoRedraw = True
   ScaleMode = vbPixels
   imgSnakeLogo.Visible = False 'Make Snake Game logo invisible

   'Draw box
   Line (25, 25)-Step(330, 265), lngSnakeColor, B
   Line (27, 27)-Step(326, 260), vbWhite, BF

   'Event loop
   Do
     DoEvents 'Allows other programs to run
     For lngWasteTime = 0 To lngMySpeed
     Next lngWasteTime
     PSet (sngX, sngY), lngSnakeColor
     sngX = sngX + sngXFactor
     sngY = sngY + sngYFactor
   Loop Until ((Point(sngX, sngY) = lngSnakeColor) Or blnStop = True)

   If blnStop = False Then
    intI = MsgBox("GAME OVER!", vbExclamation, "Snake Game")
   Else
    intI = MsgBox("GAME STOPPED", vbExclamation, "Snake Game")
   End If

   cmdStart.Enabled = True

End Sub

Private Sub cmdQuit_Click()
    End
End Sub

Private Sub cmdStop_Click()
    blnStop = True
End Sub

Private Sub cmdUp_Click()
    sngYFactor = -1
    sngXFactor = 0
End Sub

Private Sub cmdDown_Click()
    sngYFactor = 1
    sngXFactor = 0
End Sub

Private Sub cmdLeft_Click()
    sngXFactor = -1
    sngYFactor = 0
End Sub

Private Sub cmdRight_Click()
    sngXFactor = 1
    sngYFactor = 0
End Sub

 
Old January 3rd, 2008, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. it's there any error?? what do you think is wrong??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pong Game Help -XM- BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 4 June 20th, 2007 02:23 PM
SNAKE AND LADDER GAME saptarshi Pro VB Databases 1 January 24th, 2007 11:31 AM
SNAKE AND LADDER GAME saptarshi Beginning VB 6 0 January 24th, 2007 10:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.