Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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