|
Check out the FileInfo class, it should be in System.IO
It might have some stuff you could find useful.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi guys, ive JUST started c# and im having some problems. I think the reason is that im misunderstanding something with object oriented programming(i came from Delphi).
Ok, so i want to create a sort of space invaders game, and ive got this far: www.nuked.co.za/SpaceInvaders.rar
^^^^ that includes the source code(made in sharp develop 1)
Ok now my problem is this: i can only have one enemy/bullet at a time because else i have to create a picturebox for every possible bullet or enemy there may be. Now I found a way to create pictureboxes on the fly, but then I couldnt reference them from anywhere else(I need to so that the timers can make them move etc). What I mean is if I created one inside an onClick event its fine, but then I cant say this.thatthingicreated because it was not created publically(i presume). So the work around would be to just declare every name at the top and have global variables(thats my Delphi brain speaking), but thats tedious and what happens when you get a machine gun(for example).
Im sorry that im an idiot..
Thanks in advance for your help
Regards
Matt
Im lost...very very lost.
|
|
|
|
|
roguemat wrote: because else i have to create a picturebox for every possible bullet or enemy there may be
No, you're right, you're very lost. You create NO picture boxes. No game can work that way. Your best bet is to use DirectX, but if you want to try and make it work on just a form, you need to handle the paint event of the form, and draw your bullets, and everything else, directly onto the form.
What generally happens is that you keep an array of alien objects, an array of bullet objects, etc. Your paint event iterates over those arrays and draws the screen. Some other code grabs each bullet and checks if it's intersected with an alien. When you press space to fire, a bullet object is added to that array, with the position and velocity that makes it appear where it should, and move as you want it to.
I wrote a game called collision, it's far from perfect but I went through three articles explaining how I did it, and it sounds like you could learn a lot from that article ( although, again, I would say there's plenty I did wrong, being very new to C# when I wrote it ). It's on this site, just search for it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks man
will go in search of it now
-- modified at 18:18 Sunday 7th October, 2007
|
|
|
|
|
I was looking at that just the other day actually. Stumbled accross it whilst browsing some articles.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Cool - glad the article is gettng some use then.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What's new and different about Visual Studios 2008? Can I import 2005 projects to it, and also for C#, is it the same or just upgraded code? Thanks.
|
|
|
|
|
VS2008 is a beta product, you should not expect it to work 100%. There are many new language features, you'll find out all about them if you try some googling.
If 2005 projects don't import into 2008 it would be the first time Microsoft did something that stupid.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hey guys,
I have a CSV file whose contents I would like to upload to an online MySQL datbases (running on a php server) using a simple C# app.
I am not sure how to do this but I figured uploading the entire CSV file to the server
if the first step.
Is there a way of achieving this using ftp within C# somehow?
Help much appreciated!
Gerry
C# newbie
|
|
|
|
|
Can you connect with the MySQL database directly, or do you need to FTP the file and then have code on the server to parse and insert the files ?
http://www.codeproject.com/cs/internet/ftplib.asp[^] might help.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian,
Thanks for this ftp article, I'm sure it'll do the trick (yes file has to be uploaded, then Mysql inserted by running php script on server).
Many thanks!
Gerry
|
|
|
|
|
I generally mean the cell like structure.. Is this jsut a panel with a grid on it and mouse events to track which cell the user mouse is over??
|
|
|
|
|
kranius wrote: I generally mean the cell like structure.. Is this jsut a panel with a grid on it and mouse events to track which cell the user mouse is over??
Perhaps a DataGridView would be a place to start. Just a suggestion. I'm sure there are an infinite number of ways to solve the problem, but I'd likely start there.
Good Luck
“You can't teach people to be lazy - either they have it, or they don't.”
-Dagwood Bumbstead
|
|
|
|
|
In terms of data structures how about:
An array may be a structure that works as you can reference the row and column directly just like a spreadsheet.
You always pass failure on the way to success.
|
|
|
|
|
Before you think about how you are going to represent the data visually, you would be well advised to consider how it is represented in code. Would you store your information in a 2D array, or some other structure? Hint - the 2D version is very, very innefficient.
Now, on the surface it would seem that you would be well advised to use a 2D structure because that mimics the layout of the cells very well, but as soon as your cell sizes grows to any distance then the memory consumption will go right through the roof. You can simulate the 2D structure with an algorithm such as a sparse-array which is much more memory efficient.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks for the advise. Well internal structure wise, I was thinking something like a double linked list. It is really the gui side that I can't think of a good way to accomplish it..
I take a look at the datagridiew and see how it would work..
|
|
|
|
|
HI,
i like to know if there are some ready to use controls
that are not by def in C# (like button...)
For Example : Led - a.k.a light emitting diode
or Like Digital Stoper (CLock) and so on...
kobkob
|
|
|
|
|
kobibi wrote: i like to know if there are some ready to use controls
that are not by def in C#
Yes - there's a thriving industry in third party controls. That's the beauty about .NET, it's very easy to create your own controls. You should only be limited by your imagination.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
There's a Search box at the top of the Code Project website. I was able to find examples with precious little effort on my part - try it out sometime!
“You can't teach people to be lazy - either they have it, or they don't.”
-Dagwood Bumbstead
|
|
|
|
|
hi guys,please help me on how to upload an image to the database?
thanks..more power..
|
|
|
|
|
Which type of database? Have you tried searching google for such a vague topic? I suggest you search google
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Use some form of binary datatype in the database. Insert it from a byte array. Without knowing more about the basics such as which database and whether it's an ASP.NET or WinForms project then I can't really offer you any more advice than that.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Do you know something about BLOB?
Check, it may help you.
|
|
|
|
|
I found a way to write my game in c#, but it using 3d graphics. XP and voodoo3 don't agree with each other. So i need to know how to change this so i can use software or change it to full screen when it opens:
namespace WindowsGame1
{
class Engine : Microsoft.Xna.Framework.Game
{
Microsoft.Xna.Framework.GraphicsDeviceManager Graphics;
Microsoft.Xna.Framework.Content.ContentManager Content;
Microsoft.Xna.Framework.Graphics.Texture2D mytext;
Microsoft.Xna.Framework.Graphics.SpriteBatch SpriteBatch;
Microsoft.Xna.Framework.Vector2 Spritepos;
public Engine()
{
this.Graphics = new Microsoft.Xna.Framework.GraphicsDeviceManager(this);
this.Content = new Microsoft.Xna.Framework.Content.ContentManager(this.Services);
}
protected override void Initialize()
{
this.Spritepos = new Microsoft.Xna.Framework.Vector2(100f, 50f);
base.Initialize();
}
protected override void LoadGraphicsContent(bool loadAllContent)
{
if (loadAllContent)
{
this.mytext = this.Content.Load<microsoft.xna.framework.graphics.texture2d>(@"new\text\Mike1");
this.SpriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(this.Graphics.GraphicsDevice);
}
}
protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent)
{
this.Content.Unload();
}
}
protected override void Update(Microsoft.Xna.Framework.GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
{
this.Graphics.GraphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.Black);
this.SpriteBatch.Begin(Microsoft.Xna.Framework.Graphics.SpriteBlendMode.AlphaBlend);
this.SpriteBatch.Draw(this.mytext, this.Spritepos, Microsoft.Xna.Framework.Graphics.Color.White);
this.SpriteBatch.End();
base.Draw(gameTime);
}
}
}
Michael
(Up and coming Game programmer)
EST
|
|
|
|