Thank you Michael, working perfectly!
I am glad it works for you now.
Thanks Michael :)
Theres something odd in the ftEngine Class. Does CreateImage() actually loads and display the image right away? Is there a way to preload the images instead of displaying it right away?
Nothing weird there. CreateImage creates an object, loads the image and attached the image to that object. The object is active and visible right away and will render of course.
Just make it invisible via
And it iwll be still active but not render.
If you want, I can add a command so you can tell the engine not have objects visible and active right away. Something like
There is engine.SetDefaultLayer already so it fits right into this methology.
But what if you need to create like a series of bullets, or clones of enemies? The engine would have to load an image file each time that object is created. Wouldn't it be more efficient to have that image data preloaded in memory first, and then accessed again each time ever its needed?
EDIT : Oh wait, i see that there is actually two CreateImage() overload, one actually preloads it from an atlas while the other loads it directly from a file. Makes sense now :)
I'll be reviewing the book soon on here, Amazon, and at my monthly game coders meet-up.
Thanks to Packt for a review copy.
To all who bought the book... please leave a review at the sites you bought it. Thank you!
Got the book! Working through it now. Thank you Michael for writing this.
to the ones that bought the book... it would be great if you could post a link to your reviews here. My publisher is dying to know about your opinions so it would be awesome if you could share the links to your reviews.
Thanks a lot for all the support you guys have given me.
I get the following error when I try to compile for the Android target.
fantomengine.android.java' not found.
Any help would be appreciated.
At first I was very exited with this book but as I read along trying the game examples I found more and more error in the book and its a little annoying. Most of the error is easy to correct. But there should be so many.
I only have the eBook so I don't know if its the same with the printed version.
I also some times do not get what it is the code is doing, but maybe thats just me who are not so clever.
Its great that you did this book and your fantomEngine is very nice.
In chapter 6 the game should run on an iOS device but I get a lot of warnings in Xcode.
When I fix this warnings I get a bad Exec and the game never starts.
Im using Mountain Lion and the latest Xcode, maybe thats why!
Well monkey is a moving target. The parser now catches errors that it didn't when I wrote this book. So stuff that worked before needs ajustment now. If you need help fixing stuff, then let me know where and I can look at it.
@KDF - are you sure that fantomengine is located iny our sources directory?
I have the eBook and the errors I mention is lines of code that gets cut of at the edge of the page.
Leaving it impossible to read.
I dont know if this is in the paper version or something that happened when converting the book to eBook. Every now and then I have to look at the examples I downloaded from you book to see how code lines are ending.
There are also some spelling errors but I don't mind them.
@TriGaDe: Ouch, that is really bad. As customer I would be pissed also. did you contact PacktPub about it? Which viewer do you use to read the book?
Yes I have contacted Packtpub. I'm using my iPad and iBooks.
Here's the folder structure:
Here's the full error log:
E:/EDRIVE/MonkeyPro56/bin/trans_winnt -target=android -run "E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/atthedocks.monkey"
TRANS monkey compiler V1.32
E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/ftFunctions.monkey<4> : File 'E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/native/fantomengine.android.java' not found.
Monkey runtime error: E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/ftFunctions.monkey<4> : File 'E:/EDRIVE/MonkeyPro56/MonkeyBook/Chapter 7/2038_07_Code/native/fantomengine.android.java' not found.
Is there any other folder I have to put the fantomEngine.monkey into ??
You need to put the core fantomengine files into your Monkey modules directory. The only reference I can find regarding installation is on the the google code download page for fantomEngine:
Copy the content of the zip folder inside the module folder of your Monkey installation.
Installing modules is not mentioned in the book, or in the Monkey docs, as far as I can see.
Also, see here: http://www.monkeycoder.co.nz/Community/posts.php?topic=3366
Thanks Matt. Much obliged.
I also had to copy the 'native' folder into my source directory to get it to work.
Thanks Matt for helping out.
Ok, I finally got around to publish some errata for the books code to be able to still work with Monkey V70 and up and to adress the typos in the code: