Jump to content

  • Log In with Google      Sign In   
  • Create Account


Trouble with Direction and get


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Kuam   Members   -  Reputation: 117

Like
0Likes
Like

Posted 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
		{
			get;
		}

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.

Edited by Kuam, 04 July 2012 - 03:01 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS