[Qt-interest] Howto Do `hit Test' with QGraphicsItems ?

Aaron Lewis aaron.lewis1989 at gmail.com
Thu May 6 03:37:36 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/05/2010 07:06 PM, Mihail Naydenov wrote:
> If you read the docs you will find you way around.
> 
> Hints:
> QGraphicsItem::contains()

So far it's not a easy way for me to check the Position of player
against other items , i'd do some research first.

> QGraphicsItem::collidesWithItem()

Cuz in my game , i've got lots of GraphicsItem , i don't need to check a
player Item with all of the rest , so i just play around with
 collidingItems() function , see if it hits any other item.

e,g I've got walls around at the bound of map , buildings inside the map
, any NPC whatever , i don't want my player 'hit' them , so only tried
with collidingItems() , just check if it's higher than zero.

Is that a good way for doing this ?

It's not good to list all of the Item on a QGraphicsScene , and check
the player with it right ?

Thanks Mihail.


- -- 
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkviHV8ACgkQvf41sEptMqAmcwCguLzVDmmtdykjoBUVAQuViUYg
j5sAn0FpGofv/gJz3M7vtcAVrnAWHkjb
=wV1u
-----END PGP SIGNATURE-----



More information about the Qt-interest-old mailing list