Space Dodgers
Moderator: MaxCoderz Staff
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
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...
Why do you need to use control arrays, BTW? I can't think of any use for them in your current project...
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
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:(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.
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
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.
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
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
Edit: Maybe i shouldn't start with that
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
Edit: Maybe i shouldn't start with that
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
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).
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).
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
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 patternsbenryves 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).
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
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
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).
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).
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm
- Dragonwarrior333
- Regular Member
- Posts: 121
- Joined: Sat 19 Mar, 2005 1:59 pm