Week #2 Challenge: XNA Framework

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4

59 Replies - 16892 Views - Last Post: 02 February 2010 - 09:24 PM

#31 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 12 January 2010 - 07:13 PM

That sounds cool brianarn. It would be cool if you were able to find something and post it.

That is the one complaint many people have about XNA, that it is a Microsoft only technology. For people who use Windows and C# though, it has been a big bonus.
Was This Post Helpful? 1
  • +
  • -

#32 Project 2501  Icon User is offline

  • import awesome as Project_2501
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,565
  • Joined: 14-December 08

Re: Week #2 Challenge: XNA Framework

Posted 14 January 2010 - 12:57 AM

Very interesting challenge, Six. I've been meaning to get around to XNA for sometime now. I'll definitely make this my weekend project.
Was This Post Helpful? 0
  • +
  • -

#33 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 900
  • Joined: 08-August 08

Re: Week #2 Challenge: XNA Framework

Posted 14 January 2010 - 03:30 PM

whenever i try and install the xna framework it fails, im going to try completely removing visual c# and then reinstalling it and xna but any other ideas?
Was This Post Helpful? 0
  • +
  • -

#34 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 14 January 2010 - 03:33 PM

Hmmm... I'm stumped. I've never come across that problem before. Unless you are trying to use XNA 3.* with Visual C# 2005 or earlier, which I'm sure you are not.

@Project 2501: Let us know how it goes this weekend. I'd like to see what you come up with.
Was This Post Helpful? 0
  • +
  • -

#35 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 900
  • Joined: 08-August 08

Re: Week #2 Challenge: XNA Framework

Posted 14 January 2010 - 03:50 PM

im using c# 2008, i just uninstalled 2008 and then reinstalled it, i am now installing xna framework 3.1 and will see how it goes


it says it ended prematurely due to an error but no idea of what this error was.
it gives a link to log files but i have no idea which one it is

This post has been edited by ghqwerty: 14 January 2010 - 03:51 PM

Was This Post Helpful? 0
  • +
  • -

#36 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 14 January 2010 - 08:46 PM

Could be a bad download or there could be a conflicting file association. I had a problem installing a program once because of a conflicting file association. Wish I could help you more, I'd really like to see what you could come up with.
Was This Post Helpful? 0
  • +
  • -

#37 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 15 January 2010 - 09:11 AM

Here is a quick sample that I wrote to show how to move a sprite around the screen using the keyboard and not have it go off the edges of the screen. Check it out.

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace SimpleMovement
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Texture2D image;
        Rectangle position;
        Vector2 velocity;
        KeyboardState keyboardState;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            image = Content.Load<Texture2D>("alien1");
            position = new Rectangle(0, 0, image.Width, image.Height);
        }

        protected override void UnloadContent()
        {
        }

        protected override void Update(GameTime gameTime)
        {
            keyboardState = Keyboard.GetState();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            velocity = Vector2.Zero;

            if (keyboardState.IsKeyDown(Keys.Left))
                velocity.X -= 3;
            if (keyboardState.IsKeyDown(Keys.Right))
                velocity.X += 3;
            if (keyboardState.IsKeyDown(Keys.Up))
                velocity.Y -= 3;
            if (keyboardState.IsKeyDown(Keys.Down))
                velocity.Y += 3;

            position.X += (int)velocity.X;
            position.Y += (int)velocity.Y;
            if (position.X < 0)
                position.X = 0;
            if (position.Y < 0)
                position.Y = 0;
            if (position.X + image.Width > window.ClientBounds.Width)
                position.X = window.ClientBounds.Width - image.Width;
            if (position.Y + image.Height > window.ClientBounds.Height)
                position.Y = window.ClientBounds.Height - image.Height;
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
            spriteBatch.Draw(image, position, Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}


Was This Post Helpful? 0
  • +
  • -

#38 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Week #2 Challenge: XNA Framework

Posted 15 January 2010 - 11:10 PM

Not an XNA programmer, but I think Slick2D is pretty similar. It's a little less supported being a community project, but it's cross platform (Java) and I don't think it requires you to have a graphics card supporting shaders. There are some tutorials in the wiki, and a lot of neat examples in the subversion repository.

Might be worth checking out for anyone who isn't able to do this week's challenge because of technical issues (wrong OS, wrong hardware, etc). :)
Was This Post Helpful? 0
  • +
  • -

#39 Vermiculus  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 26-February 09

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 12:03 PM

Quote

BN+VS*' date='11 Jan, 2010 - 08:32 AM' post='889072']
XNA fails for not working with VS2010 beta 2 :(

VS2010 Beta 2 fails for not working with XNA. Then again, it is a beta... not an RTM
Was This Post Helpful? 0
  • +
  • -

#40 .Aaron  Icon User is offline

  • Rock, paper, scissors, lizard, Spock
  • member icon

Reputation: 61
  • View blog
  • Posts: 2,860
  • Joined: 04-August 09

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 12:32 PM

And I give you, the result of my bad drawing skills (lol), two emoticons I found online years ago, and my first time using XNA/C#:

Attached File  week2of52wofc.zip (77.27K)
Number of downloads: 161

Basicaly just lets you make the sniper emoticon shoot a the moving vehicle that keeps going across the screen and move a few things around. Pretty simple.

This post has been edited by .Aaron: 16 January 2010 - 12:50 PM

Was This Post Helpful? 0
  • +
  • -

#41 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 12:35 PM

Thanks .Aaron for sharing this with us. I look forward to seeing what you came up with. Also, we know that programmers are not always graphics artists. The object was just to try XNA and expand your horizons. Again, thanks for sharing. :)
Was This Post Helpful? 0
  • +
  • -

#42 .Aaron  Icon User is offline

  • Rock, paper, scissors, lizard, Spock
  • member icon

Reputation: 61
  • View blog
  • Posts: 2,860
  • Joined: 04-August 09

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 01:24 PM

I know, I did mean it jokingly. :rolleyes: Hope people start getting a few more in here, never thought I'd be the first one to submit something.

Oh, and no hitting the sniper emoticon when moving things around...

This post has been edited by .Aaron: 16 January 2010 - 08:01 PM

Was This Post Helpful? 0
  • +
  • -

#43 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 06:55 PM

Well, here is what I came up with. It is a simple simulation of a Battleship Destroyer game. All you need to do is launch missles from the bottom ship, so those hit the top battleship. Here is a video showing how it looks like:



The source (XNA - Windows Game) is linked to this post (the attachment would be too big). The whole concept can be easily modified by adding more ships, score penalties and a different velocity for the missle, but once again - this is just a demo.

The project:
http://cid-703206d1d...ipDestroyer.zip
Was This Post Helpful? 0
  • +
  • -

#44 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #2 Challenge: XNA Framework

Posted 16 January 2010 - 08:16 PM

Nice Core. You came up with something really nice looking. I like the background that you have. Will have to take a look at the source code.
Was This Post Helpful? 0
  • +
  • -

#45 Project 2501  Icon User is offline

  • import awesome as Project_2501
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,565
  • Joined: 14-December 08

Re: Week #2 Challenge: XNA Framework

Posted 17 January 2010 - 02:45 PM

Well, unfortunately I was swamped with work this weekend, however, I did learn a lot about C# because of this challenge, so it wasn't a total loss on my end. I even logged into my XNA Creators Club account for the first time in about a year - forgot I even had one.
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4