useflashpunk / FlashPunk

A free ActionScript 3 library designed for developing 2D Flash games. It provides you with a fast, clean framework to prototype and develop your games in. This means that most of the dirty work (timestep, animation, input, and collision to name a few) is already coded for you and ready to go, giving you more time and energy to concentrate on the design and testing of your game.
http://useflashpunk.net
MIT License
390 stars 134 forks source link

Code errors report #59

Open udreamer opened 12 years ago

udreamer commented 12 years ago

While I was using flash punk in FDT5, it generated an error report which cause I can build the project. Here is the error report.

You cannot assign anything to Void. Found returnupdateBuffer(); at line 252 column 6. Image.as
You cannot assign anything to Void. Found returnupdateBuffer(); at line 256 column 6. Image.as
Could not resolve function 'update' at line 101 column 10. Hitbox.as
Could not resolve function 'update' at line 55 column 19. Hitbox.as Could not resolve function 'update' at line 67 column 19. Hitbox.as Could not resolve function 'update' at line 79 column 19. Hitbox.as Could not resolve function 'update' at line 91 column 19. Hitbox.as Could not resolve type reference to 'Sprite' at line 6 column 28. Main.as Incompatible types Class and ByteArray. Found at line 722 column 26. FP.as Incompatible types int and Boolean. Found at line 154 column 4. Input.as Incompatible types int and Boolean. Found at line 175 column 4. Input.as
You cannot assign 'Class' to 'Bitmap'. Found 'newCONSOLE_DEBUG' at line 208 column 34. Console.as
You cannot assign 'Class' to 'Bitmap'. Found 'newCONSOLE_OUTPUT' at line 209 column 35. Console.as
You cannot assign 'Class' to 'Bitmap'. Found 'newCONSOLE_PAUSE' at line 211 column 34. Console.as
You cannot assign 'Class' to 'Bitmap'. Found 'newCONSOLE_PLAY' at line 210 column 33. Console.as
You cannot assign 'Class' to 'Bitmap'. Found 'newCONSOLE_STEP' at line 212 column 33. Console.as
You cannot assign 'Class' to 'Entity'. Found 'newclassType;' at line 231 column 13. World.as

Also there are 97 warnings

BlckKnght commented 12 years ago

So I took a look at these. The first two are objections to calling "return updateBuffer()" from in a function with return type void. However, since the updateBuffer() method also has return type void, I think it's legal, if perhaps inelegant. It would be easy enough to separate out the function call and the return statement, if we wanted to.

I don't understand the Hitbox issues. All the calls are to list.update(), where list is a MaskList object (inherited from Mask). The MaskList class has an update method (overriding the empty version in Mask), so it seems like it should be fine. The only thing I can think of is the fact that update() has the protected access type, but since both Hitbox and MaskList are subtypes of Mask (where the update method is declared) it seems like either one should be able to call it on the other.

All the rest are complaining about types. The two in Input are semi-legit. They're about the implicit conversion of integers to Booleans (where anything non-zero is treated as true). That could be tightened up with a cast or a the addition of "!= 0". The rest are bogus. Class objects are pretty weird, and the program doesn't seem to understand that given some variable X holding a class, "new X" will have a different type than X did.

erikyuzwa commented 12 years ago

I'm running into this as well using the latest FDT5. I've submitted pull requests for the Input.as and Mask inheritence issues and will see if I can help with any workarounds on the others. I'll see if I can pull down a Flash Builder trial to see if the same errors come up. (eg. is this a Mac only issue, an FDT5 only issue or even an issue with the latest Flex SDK)

danishgoel commented 12 years ago

I don't have any of the mentioned issues, I use latest Flex SDK 4.6, under Win 7 on FlashDevelop. This seems to be something relating to, as erikyuzwa said, either FDT or MacOSX.