BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 08-24-2007, 09:34 AM   #1 (permalink)
New Member
Join Date: Aug 2007
Model: 8800
Carrier: AT&T
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default MIDP Sprites and coordinates

Please Login to Remove!

Hey everyone,

I have just started using the MIDP 2.0 for the BB. I am using an 8800 and the 8800 simulator. I am experiencing a number of issues on both the simulator and the device, but if I can get this first one answered, the others may be related.

What I am trying to do is relatively simple, I am placing a Sprite on a GameCanvas.

But I immediately noticed that the coordinates in which is setPosition() on my sprite appears to be at half resolution?

So if I create a single pixel (1x1) sprite and call sprite.setPosition(0,0) my sprite is placed at the upper left of the screen, but if I call setPosition(1,0) on a second sprite, it is placed at the actual position of 2,0, leaving a gap between them.

This seems strange and not what I expect. Is this normal, or do I have something set up wrong.

Let me know if it will help to post an example.
Old 08-25-2007, 06:09 PM   #2 (permalink)
New Member
Join Date: Aug 2007
Model: 8800
Carrier: AT&T
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Oh No!!

I figured out what is going on, and it is not good.

Since I was seeing such weird things using the MIDP 2.0 GameCanvas classes on the blackberry, I decided to try other MIDP platforms.

Unfortunately the problems appear to be with the blackberry MIDP 2.0 implementation. I have tried some sample apps on multiple platforms (using NetBeans) and here are the things I have found with the Blackberry implementation of "javax.microedition.lcdui.Game"

1. When placing a Sprite, the (X,Y) location is not correct, the actual placement will always be (x*2,Y*2) instead.

2. When using a sprite with multiple frames, the position of the sprite will be offset by HALF the location of the frame in the sequence. So if you supply the sprite frames in a vertical strip, when using setReferencePixel(x,y), you really have to call setReferencePixel(x/2,y/2 + (frame*(framewidth/2))) in order for your sprite to show up on the screen at (x,y).

3. Collision detection using the Sprite.collidesWith() is also pretty messed up, I haven't figured out a work-around yet. I don't think there is one, I think that the internal positions are being used, but the layers are being placed on the screen wrong. So either the collisions work, or the screen looks right, and you won't get them both to work right.

I don't know how any of this affects the javax.microedition.lcdui.Graphics classes yet, but I don't think it does, everything I've used seems to work as I expect.

Again, I have verified this with other sample applications compiled for multiple platforms, as well as my own.

Does anyone know of any updates or patches? Does anyone know where/who I can submit this bug report to?

Obviously the blackberry is targeted to professionals (like myself) and this is the MIDP Game API, but even professionals like to play sometimes.

And these problems make porting of MIDlets tough.

Last edited by NebulaSleuth : 08-25-2007 at 06:21 PM.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Parker MPA-03-154 Servo Amplifier
Parker MPA-03-154 Servo Amplifier pictureFanuc A06B-6079-H201 Servo Amplifier Module
Fanuc A06B-6079-H201 Servo Amplifier Module pictureFanuc Servo Amplifier Unit, # A06B-6058-H223, Used,
Fanuc Servo Amplifier Unit, # A06B-6058-H223, Used,  pictureFanuc A06B-6079-H206 Servo Amplifier Module .
Fanuc A06B-6079-H206 Servo Amplifier Module . picturePLANTRONICS VISTA M12 AMPLIFIER NEW OLD STOCK LOT OF 5

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.