Trying to make a backdrop; getting override error


(Nate ) #1

Hey guys I am here again! So I am trying to get a scrolling backdrop in my game and I have this class set up all good and such… but I keep getting an error that sounds both unusual and oddly familiar… any thoughts?

Error is this, “col:29 Error: Method marked override must override another method.”

here is the whole class:

package entities {

import net.flashpunk.FP;
import net.flashpunk.graphics.Backdrop;
import net.flashpunk.graphics.Image;

public class theBackground 
{
	[Embed(source = '../assets/background.png')]
	
	public static const BACKGROUND:Class;
	
	public function theBackground() 
	{
		graphic = new Backdrop(BACKGROUND);
		graphic.scrollX = .5;
		graphic.scrollY = .5;
		
		layer = 100;
	}
	
	
	
		override public function update():void
	{
		x -= FP.elapsed * 20;
		y -= FP.elapsed * 10;
	
	}
	}}

(TheHuckleberryWill) #2

You are overriding something that does not exist! Make sure you are inheriting from another class, in your case, entity.


(Nate ) #3

What exactly do you mean? I am confused because all my other entities in my game so far I set up this way and they worked fine… do I need to import backdrop into my world.as?


(Jacob Albano) #4

You have this:

public class theBackground

It should be

public class theBackground extends Entity

(Nate ) #5

You are right! Once again Jacob you have saved the day! I am not sure how I missed that! Thank you so much!