Space Dodgers

A forum where you can announce your awesome project(s).

Moderator: MaxCoderz Staff

User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

Wierd ....the link works now..... :?

Benryves: I just downloaded VB.net for my other faster computer so I was just wondering if you had any tips for going form vb6 to vb.net?
(Like control arrays) :D

Edit: Do you have to add each seperate control array to the toolbox?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

My biggest tip is to make sure to use the .NET framework to do things, not the VB6 compatibility functions. The big advantage is that you can then pick up any other .NET language and use it without having to relearn everything.

Why do you need to use control arrays, BTW? I can't think of any use for them in your current project...
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

Why do you need to use control arrays, BTW? I can't think of any use for them in your current project...
Same thing I was wondering aswell... Maybe he uses it to move pictureboxes (just a wild guess)... rather than moving sprites within a bitmap
Image
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

Yeha I know it's bad to but all my sprite data is in pictureboxes on the form therefore i can manipulate it easier with all the mask data and stuff like that in the BitBlt functions. :oops:
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

OK, VB.NET deals with GDI+, so you can forget kludgy Win32 GDI ;)

You can use the Bitmap and Image classes to hold a picture (for example of your spaceships). They are neatly alpha blended, so you can just save your images as PNG or GIF files (no need for masks).

For the drawing itself, you can override the "OnPaint" method of the form. OnPaint is called when Windows asks your form to redraw itself. You can force it to do this (redraw) by calling Invalidate() from within your code. Naturally, this will flicker as it redraws, so you must set the DoubleBuffered property of the Form to True first. Drawing is carried out by a Graphics object.

I'm probably not making much sense, so here's a bit of sample code:

Code: Select all

Dim Spaceship As Bitmap = New Bitmap(Path.Combine(Application.StartupPath, "spaceship.png"))

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

    ' e contains the event arguments.
    ' Of most importance is e.Graphics, the graphics object we can use to draw with!

    e.Graphics.Clear(Color.Black) ' First up, clear the form

    ' Draw a spaceship

    Dim x As Integer = 30
    Dim y As Integer = 20

    e.Graphics.DrawImage(Spaceship, x, y)

End Sub
(NB: If any of the things above get a blue squiggly line because it can't find the reference, right-click them, select "Resolve->Imports Blah.Blah.Blah").

I see you currently 'embed' all your graphics into the application. You can just as easily do this in .NET using the resource manager.

In your main update loop, just make sure to call Invalidate() at the end to force the Form to redraw.
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

I dont really plan on doing this game on VB.net but my future games will probably be using it.

I also am trying to do this http://www.upgradeyourgame.com/ but it wont compile right. I opened the project and it gives me errors. I did install Active X .... I think :oops:

Edit: Maybe i shouldn't start with that
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

What has ActiveX got to do with anything?
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

I think it had to do with that game :?

Oh well I'll wait till I am more comfortable in VB.net and still do some VB 6 for my game.

Benryves if you tried the game do you have any complaints or suggestions?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Are you confusing ActiveX (old-school component/control system) with DirectX (high-performance graphics, sound, music, networking and input library?) If so, just install the DirectX SDK and it comes with a number of Managed DirectX samples and tutorials.

In any case; NanoWar pretty much raised the same points as I would have done (it's a bit unbalanced - too hard without autofire, too easy with autofire). Beyond that, all is good (though it could do with a little variation in attack patterns).
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

benryves wrote:In any case; NanoWar pretty much raised the same points as I would have done (it's a bit unbalanced - too hard without autofire, too easy with autofire). Beyond that, all is good (though it could do with a little variation in attack patterns).
He does bring up some good points and I dont know how i should "balance" it out. There will be less enemies to start out so you only have to focus on like four enemies, and by the time that there is a lot of enemies you will have a better weapon. Also I don't really know what you are talking about with attack patterns :?:

Also how do you do key down stuff/ keyboard input? Keycode isnt there
andI dont understand what "e" is

Edit: I think I figured out the e and the keycode because e.keycode is like the keycode
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

With .NET, events pass an EventArg object. Certain event handlers have extended EventArg classes (such as KeyEventArgs) which inherit from the EventArg to provide extra information.

Hence, OnKeyUp and OnKeyDown pass an object which contains a KeyCode (the physical key that was pressed), whereas OnKeyPress passes an object that contains a KeyChar (the letter that was pressed).
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

Sorry havent been working on my game lately, I got adicted to VB 2005 Express..... :twisted: ( Thanks benryves )

For rigth now all I want to fix is the stuff that you guys mentioned and the title screen and then maybe another beta release :D
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

got adicted to VB 2005 Express..... ( Thanks benryves )
What?! no thanks to me :cry:
Image
User avatar
Dragonwarrior333
Regular Member
Posts: 121
Joined: Sat 19 Mar, 2005 1:59 pm

Post by Dragonwarrior333 »

OOps I can't believe I forgot kv83 :x
Post Reply