• Advertisement
Sign in to follow this  

Trouble with Direction and get

This topic is 2055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement