Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Jun 2012
Offline Last Active Jul 04 2012 04:00 PM

Topics I've Started

Trouble with Direction and get

04 July 2012 - 01:07 PM

Hey everyone,

Having some trouble with a particular part of code. I'm working on creating various classes for user-directed and automated sprite movement. I have created a class Sprite that I'm working in. I have other classes AutomatedSprite and UserControlledSprite.

I put the following code in my Sprite class:

public abstract Vector2 direction

I go on to define the get in the above mentioned classes. However, when I try to compile, I get the error for this particular piece of code:

'AnimatedSprites.Sprite.direction.get' is abstract but it is contained in non-abstract class 'AnimatedSprites.Sprite'

I'm working out of Learning XNA 4.0 and I thought I was supposed to put it in this class. I'm not sure where else to put it. I tried putting it in my first Game1.cs class, but that didn't work either. Stumped. Any help is appreciated.

EDIT: Figured it out. Missed where I needed to make the class Sprite abstract. I tried it, but I put the abstract on the wrong side of class causing an error. Definitely kick the programmer on this one. I hope this helps someone else learn from my mistake.

Problem with Textures

16 June 2012 - 02:31 PM

I'm having trouble drawing images in my program. It is not a variable problem or syntax problem so I'm a little lost.

To clarify, this is in XNA.

I've added the image I want to use to the content (lets just call it Pic), have labeled Texture2D, and have tried to implement the image into my program with the following code:

[source lang="csharp"]myTexture = Content.Load<Texture2D> ("Pic");[/source]

I have also tried this.Content.Load<>

In either case, when I compile the program it tells me that file "Pic" cannot be found. Not sure what I'm missing. I've followed a couple tutorials to a T and no matter which way I've done it, or that I've tried adding different picture files to Content, it cannot "find" the image.

Any help is appreciated.

EDIT: I wiped the file I was working with and tried with a fresh file, only inserting the applicable code. It worked...idk why it couldn't find my file before

Hello from a New Guy

16 June 2012 - 03:04 AM

Hello everyone!

I'm new to the gamedev community as well as programming. When I was younger, I spent a lot of time diving into MS BASIC and learning the fundamentals of programming in DOS 6.

Recently I've decided to get back into it and learn a modern language. I was going to go for C++, but some lifetime programming friends suggested I jump into C# first and move around to other languages as necessary. I found that to really understand the raw concepts I had to invest in some books to help guide my through step by step concepts (I'm a visual learner and I can't "duplicate" code, except when there is a specific sequence of methods that do a particular action which I haven't learned yet. What I mean is that, in general, I need to know why argumentX goes into methodY and why myVar is called here and there).

Anyway, I've progressed fairly quickly through some books, and I'm currently practicing my XNA. I'm working through Microsoft's XNA Game Studio 4.0: Learn Programming Now.

I'm asking the community if they have any knowledge of some really helpful beginner -> Intermediate books specifically on C# and XNA game development which you used.

I am doing this as a hobby now (I'm in Afghanistan and while I am not doing my duty I am programming to pass the time), and perhaps when I return I'll complete my degree in this field. I have aspirations of a 3d, possibly multiplayer game in the future, but I am very aware I need to go through the steps to learn how the mechanics work.

Once I work through collision, mapping, AI, and some basic graphics, I'll probably create a GDD for a basic 2D style RPG, which will be turn based or action based depending on whichever you all think would be easier for me to go through the first time.

Sorry I wrote a whole lot...won't do that again LoL. Thanks.