Motorola C550, C450, C370 technical manual PlayField Methods, Public void addSpriteSprite s throws

Page 51

8

Gaming API and Sound

PlayField are all empty (tile 0 - a reserved tile and represents an empty square). A tile set can later be added using setStaticTileSet().

PlayField Methods

The PlayField class defines the following methods:

public void addSprite(Sprite s) throws

NullPointerException – Add a Sprite to the PlayField. Ignores the request if the Sprite is already associated with the PlayField.

public void removeSprite(Sprite s) throws

RuntimeException, NullPointerException – Remove a Sprite from PlayField.

public void removeAllSprites() – Remove all Sprites from PlayField.

public int createAnimatedTile(int staticTileIdx) throws IndexOutOfBoundsException – Creates a new animated tile and initializes it with a static tile index. Returns the index to use when referring to this animated tile. The indices for animated tiles will be negative (<0) and the indices for the static tile set will be positive (>=0). The index sets do not overlap and therefore indices for static and animated tiles can be used interchangeably in the methods that set or move the contents of the PlayField cells. The first animated tile shall have the index -1, the second, -2, etc.

public void setAnimatedTileImage(int animTileIdx, int staticTileIdx) throws IndexOutOfBoundsException

Sets the static tile that will be displayed in any cell that contains the animated tile. The method parameters are animTileIdx - index of the animated tile, and staticTileIdx - index of a static tile to be referenced by the animated tile.

public int getAnimatedTileImage(int animTileIdx) throws IndexOutOfBoundsException – Get the static tile referenced by an animated tile, and returns the index of the static tile that is currently referenced by an animated tile.

public void setCell(int celCol, int celRow, int tileIdx) throws IndexOutOfBoundsException, ArrayIndexOutOfBoundsException – Sets the tile to be displayed in a cell. The tile can be either a static or an animated tile. The method parameters are celCol - column of cell to set, celRow - row of cell to set, and tileIdx - index of tile to place in cell.

public int getCell(int celCol, int celRow)

throws.ArrayIndexOutOfBoundsException – Gets the index of the static or animated tile currently displayed in a cell.

public void moveTiles(int dstCol, int dstRow,

int srcCol, int srcRow, int width, int height) throws ArrayIndexOutOfBoundsException – Move a rectangular set of tiles from a source location to a destination location. Source cells are left empty. If the

51

Image 51
Contents Technical Manual Table of Contents Lcdui JAD Attributes Disclaimer IntroductionPurpose AudienceReferences Acronym Description Revision HistoryDefinitions, Abbreviations, Acronyms Date Name ReasonDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformJava VM Description DisplayNetworking File & RMSDeveloping and Packaging J2ME Applications Guide to Development in J2MEIntroduction to Development Page OTA Procedure InstallationDownloading Applications Program and Data space notes Java Application Installer/De-Installer Jaid Starting ApplicationsExiting Applications Error Checks Launching Web Session for Http DownloadDownloading MIDlets XML Screen Renderings BombMan is back, now on your Taichi series of handsets Taichi handset New Games MIDlet Lifecycle Application ManagementMIDlet Suite Installation MIDlet Suite De-installation DestroyApp MIDlet Suite UpdatingCaller Purpose MethodStartApp or the pauseApp Using startApp MIDlet Control of MIDlet State Transitions Java SystemPage Network Connections Network APIClass Descriptions URL Format IOException when it detects a time-out conditionTCP Sockets UDP SocketsImplementation Notes Network API Description LcduiLcdui Gaming API and Sound Functional DescriptionClass Hierarchy Gaming API containing a sound API Using BackgroundMusicBackgroundMusic Class BackgroundMusic MethodsGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Class ImageUtil FieldsImageUtil Methods RgbData Using ImageUtilPalleteImage Class PalleteImage ConstructorPalleteImage Methods Public void setTransparentIndexint index throws Using PalleteImage PlayField Class Using Static and Animated TilesUsing Sprites Defining View WindowsPlayField Constructor 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Methods Using SoundEffectSoundEffect Class Sprite ClassAnimation Frames Sprite DrawingSprite Constructor Sprite Methods Page Public final void drawGraphics g throws Using Sprite FileFormatNotSupportedExceptionSprites Java Gaming Sound API Java Gaming Sound APIMax Midi Extension Support FileFormatNotSupportedException ConstructorsVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name RecordStore Record Management SystemClass Description Code ExamplesCaveats TipsPhonebook Access API Phonebook AccessSample of code to create object of PhoneBookRecord class Phonebook Access API PermissionsSimmemory Sample of code for calling of ‘getMaxEmailLength ’ method Sample of code for calling of ‘isPrimaryint speedNo’ method Sample of code for calling of ‘getNumberCategories’ method Sample of code for calling of ‘setCategoryView’ method Sample of code for calling of ‘getUsedRecords’ method Int index = ReceivedRecord.getRecord1 Intelligent Keypad Text Entry API ITAPKey Mapping for the C370, C450, and C550 Appendix a Key MappingCenter Select END Available Memory Appendix B Memory Management CalculationAppendix C Online FAQC370, C450, and C550 Spec Sheets Appendix D Spec SheetsMotorola Developer Information Tools DocumentationReferences Purchase Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb