I'm new to vb and am trying to make a war strategy game. I have made it so I am able to select a character, however, I can only get the picture to go straight to the top of the screen. How do I get it to go where the mouse clicks?:confused:
Printable View
I'm new to vb and am trying to make a war strategy game. I have made it so I am able to select a character, however, I can only get the picture to go straight to the top of the screen. How do I get it to go where the mouse clicks?:confused:
Hi,
I hope to encourage you here...so please read.
This is an ambitious undertaking for a new VB programmer. Have you programmed in other languages before or is this your first one? I ask because it seems to me and perhaps others reading this that you are taking a very big step here. As a result, the first thought when I read this was to skip you because I had no clue what you had accomplished in your program since you were not specific.
If you have programmed in another language and have considerable experience with programming concepts, attach your source code that you have written and others will be more likely to help. : )
If you are new to programming, pick up a book "Teach Yourself VB in..(you fill this in)". Do ALL lessons, don't stop after the first 5 like most newbies do...see it all the way through. Think of your game concept as you do..along the way ideas will bounce around in your head...don't get distracted...stay focused...when you are finished with the book...plan your program on paper...figure out what you know and don't know...and then search this site. You will be amazed at what this will do for your chances of succeeding.
Follow this book up with another on "Teach Yourself Game Programming with VB...." or read tutorials on the internet. Sample source code is everwhere...much of it is lousy because it is not well commented but I have still found tons of stuff that was properly documented.
If you are a newbie, you can go to my site at http://www.homeschooling-online.com and download 47 lessons (PDF) for QBASIC for free. Learn the basics there. This will give you an edge on other VB newbies who have no experience writing programs. The lessons start at the beginning and teach you how to move sprites around a 2D space, create user-defined types (important to know), use trig in rotating lines, create sprites and play with 2D arrays. These concepts will transfer to your specific game idea....and of course it is much simpler to program in VB then QBASIC. (Try programming a button so a mouse click will bring up a popup message box...aargh!)
I would have written a VB course but frankly, once you know how to program in QBASIC you can learn VB, PERL, PHP, C/C++...the list goes on....because concepts are universal despite the language....it just takes sample source and a short tutorial.
Best of luck,
Chuck
Thanks Chuck. I have done a bit of work in VB before. I wouldn't classify myself as a pro but I do have to games on my record (one player and two player) so I'm not totally helpless.
We spent about two months working on VB at school but we never learnt anything unsing the mouse. I will try to attach a code and maybe the whole thing (it's only about 300kb) later or another day. I can't do it today as I'm at the worng computer. Maybe this might help users see my dilema.
110359:)
in form_mousedown put the following code:
Picture1.left = X
Picture1.top = Y
That should do the trick
Thanks. Anythings worth a try.
Ain't it?