Grab Image
Monkey Forums/Monkey Programming/Grab Image
| ||
Hello, I am getting this error during runtime: Monkey RunTime Error: TypeError: Cannot Read property "f_x" of undefined Here's a snippet of the code that causes the error: [codebox] Field ctr:int = 30 Field whiteghost:int = 0 If whiteghost <> 360 Then If whiteghost = (4 * 60) + ctr Then For Local foe:= EachIn foes foe.img = char.GrabImage(2 * 24, 4 * 24, 24, 24, 2, Image.MidHandle) Next ctr += 30 ElseIf whiteghost = (4 * 60) + ctr-15 Then For Local foe:= EachIn foes foe.img = char.GrabImage(0 * 24, 4 * 24, 24, 24, 2, Image.MidHandle) Next EndIf whiteghost += 1 EndIf[/codebox] I am trying to recreate pacman and I keep changing the image when they start blinking while they are animating. Any other images I change which doesn't cause a series of changes won't cause this error. What might be a solution to this? I have been stumped in this area for a long time trying to figure it out. Can someone also explain why this is happening? |
| ||
Are you sure that it is that code part? The line number you get is not the line inside the monkey script, it is in the build code file. f_ is a prefix of a class field. The field x wasn't found. Your script doesn't use x at all so it must be something else I think. |
| ||
Hi Mike. Thanks for replying quickly on my problems all the time. If it helps, I'm using your fantomEngine with the latest version and MonkeyPro 63b. I tried disabling all my graphics method to test it and just activated this snippet and the CreateAnimImage on all foes. It sometimes can go about two counts in the loop before reaching the error. |
| ||
It also helps to activate strict mode via a STRICT statement at the top of your script. Please add this if you haven't already. |
| ||
Yes I have STRICT activated. |
| ||
I'm using your fantomEngine with the latest version and MonkeyPro 63b Please update to Monkey V69 at least. If you can't figure it out, then you can send me the project to mike (a t ) whiteskygames (d ot) com if you want and I can have a look tonight. This code snipped doesn't use any method from fE so I would be surprised if there is something that breaks it. |
| ||
Ok sure... I don't mind at all. I'll try to tinker with it more though and thanks. |
| ||
After you update, make sure you delete the build folder. |
| ||
I've sent you the mail |