• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Question on the images used in Sprite class listing from SCMAD Exam Guide book.

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to execute the Listing 6.5 and 6.6 (MIDlet) from the SCMAD Exam Guide book. It is for a GameCanvas to display an animated Sprite according to its frame sequence.

In the following piece of code, I'm not clear what I should use for the man1.png. I created a small PNG file of a stick man in Paint. But am getting I/O access error. Complete listing for this exmaple is found in http://www.scmadbook.com/index.php/Code#Sprite_Sequence_MIDlet_.28Listing_6.6.29.

What is expected in the PNG file. Please help. I'm executing this in NetBeans v6.5 using the default emulator.



Regards,
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jane,

We'll post the images referred in the book shortly on the website. Meanwhile, you should be able to use any PNG file (30px wide by 60px long). Make sure that it is in the location referred in the code (under the "res" folder).
 
Jane Joseph
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sathya,

Thanks for your reply. The I/O access error was indeed due to a location and a filename issue. I was using lowercase .png; but image was stored under as .PNG. (duh...).

I created 4 pictures of 30 X 60 dimension and pasted them together using Paint. Was able to successfully run the program now, so that the four pictures were being displayed one after the other.

Thanks!,
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jane Joseph wrote:
I created 4 pictures of 30 X 60 dimension and pasted them together using Paint. Was able to successfully run the program now, so that the four pictures were being displayed one after the other.


Hi Jane,
Please see below for the original image:


You can get it from here as well.

Thanks,
Ko Ko
 
Jane Joseph
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ko Ko,

Executed the program with the original image that you sent. Was very happy to see the dancing man finally! Thank you very much.
(Only a slight change with regards to the image dimensions were required viz. sprite = new Sprite(manImage, 21, 43);)

Regards,
 
Are we home yet? Wait, did we forget the tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic