Motorola C370, C550, C450 technical manual Public boolean collidesWithAnyTileSprite s throws

Page 53

8

Gaming API and Sound

collidesWithAnyTile(Sprite) and collidesWithTiles(int, int, int, int, Sprite, boolean) complement each other. Sprite s does not have to have been added to the PlayField. The collision detection will proceed as if the Sprite is on the PlayField. That is, its location will be treated as relative to the origin of the PlayField's coordinate system.

public boolean collidesWithAnyTile(Sprite s) throws

NullPointerException – Check for Sprite collision with PlayField tiles. Return true if the Sprite overlaps with a cell that contains a tile (i.e. a cell containing a non-zero tile index). Sprite s does not have to have been added to the PlayField. The collision detection will proceed as if the Sprite is on the PlayField. That is, its location will be treated as relative to the origin of the PlayField's coordinate system.

public boolean collidesWithTiles(int col, int row, int width, int height, Sprite s, boolean pixelLevel) throws NullPointerException, ArrayIndexOutOfBoundsException

– Check for Sprite collision with a region of PlayField tiles. It returns true if the Sprite overlaps with a cell in the defined region that contains a tile (i.e. a cell containing a non-zero tile index). If pixelLevel is true, this method will report a collision only when opaque Sprite pixels overlap opaque tile pixels. This method complements the collidesWithAnyTile(Sprite) method by letting the programmer focus their search and find specific tiles or regions of collision. This is similar to how Sprite.collidesWith(Sprite, boolean) complements collidesWithSprites(Sprite). The method parameters are the following: row - Row of top-left cell for collision check region; col - Column of top-left cell for collision check region; height - Height, in rows, of area for collision check; width - Width, in rows, of area for collision check; s - Sprite to check for collision; and pixelLevel - Boolean indicating whether collision detection should be done at a pixel level instead of simply as boundary checks.

public void setStaticTileImage(int staticTileIdx, Image img, int x, int y) throws NullPointerException, ArrayIndexOutOfBoundsException – Modify the image associated with a static tile. Replace the image currently associated with a static tile with a new image of the same size. New static tile image will be extracted from the image passed in, starting from pixel (x, y) in the new source image and extending for getCellWidth() pixels horizontally and getCellHeight() pixels vertically. As at tile set creation time, if a mutable source image is used, behavior of the tile set should be as if the new image were cached. Updates to the mutable source image will not cause a change in the appearance of the tile image.

public void setStaticTileSet(Image img, int tWidth, int tHeight) throws NullPointerException,

IllegalArgumentException – Replaces the current static tile set with a new static tile set. See the constructor PlayField(int, int, Image, int, int) for information on how the tiles are created from the image. If the new static tiles have the same dimensions as the previous static tiles, the view window will be unchanged. If the new static tiles have different dimensions than the previous static tiles, the view window will be reset to the construction default, i.e. the entire grid dimension. If the new static tile set has as many or more tiles than the previous static tile set, then the animated tiles will be unchanged, and the contents of the PlayField grid will be unchanged. If the new static tile set has less tiles than the previous static tile set, then the PlayField grid will be reset to completely empty, and All animated tiles will be deleted.

53

Image 53
Contents Technical Manual Table of Contents Lcdui JAD Attributes Purpose IntroductionAudience DisclaimerReferences Definitions, Abbreviations, Acronyms Revision HistoryDate Name Reason Acronym DescriptionDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformNetworking Description DisplayFile & RMS Java VMIntroduction to Development Developing and Packaging J2ME ApplicationsGuide to Development in J2ME Page Downloading Applications OTA ProcedureInstallation Program and Data space notes Exiting Applications Java Application Installer/De-Installer JaidStarting Applications Downloading MIDlets Error ChecksLaunching Web Session for Http Download 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 conditionImplementation Notes TCP SocketsUDP Sockets Network API Description LcduiLcdui Class Hierarchy Gaming API and SoundFunctional Description BackgroundMusic Class Using BackgroundMusicBackgroundMusic Methods Gaming API containing a sound APIGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Methods ImageUtil ClassImageUtil Fields RgbData Using ImageUtilPalleteImage Methods PalleteImage ClassPalleteImage Constructor Public void setTransparentIndexint index throws Using PalleteImagePlayField Class Using Static and Animated TilesPlayField Constructor Using SpritesDefining View Windows 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Class Using SoundEffectSprite Class SoundEffect MethodsSprite Constructor Animation FramesSprite Drawing Sprite Methods Page Public final void drawGraphics g throws Sprites Using SpriteFileFormatNotSupportedException Max Midi Extension Support Java Gaming Sound APIFileFormatNotSupportedException Constructors Java Gaming Sound APIVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name Class Description Record Management SystemCode Examples RecordStoreCaveats 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 SheetsReferences Purchase Motorola Developer Information ToolsDocumentation Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb