Someone please help me identify my game pieces in my game. I have 7 different types of pieces randomly generated by the computer filling a 10x10 grid. How can I identify which piece is at say position 1x1. I have tried using a ray sensor to identify the piece.
for example:
pieceimchecking = pieceray.gethitobject() (what value would this return if original piece was named Army, and lets say this one is army.006) (how can I print this value on the screen, pieceimchecking = printonscreenhow?)
then:
nextpiece = pieceray.gethitobject()
then:
if pieceimchecking = nextpiece…do something (won’t work cause one piece is army.004 and the other is army.034)
I have also tried assigning string properties to all the pieces and done a very similiar thing
for example:
army piece has a string property called army
pieceimchecking = propertysensor.gethitobject() (how do I actually identify the property not the object?)
nextpiece = propertysensor.gethitobject()
if pieceimchecking = nextpiece…do something
should I use 7 different sensors and check to see if the are true or false…think at one point I tried this too. So if army sensor is true then I’m looking for army pieces next to that one.
I have also tried using my piecesensor to gethitobject and then pieceimchecking.name.split(".",2), So if the piece I am checking is army.021 then I could split the name and then check to see if army = army
Someone please help a self taught (newbie to Blender game engine and python). I understand the concepts very well but not the syntax of python. I have used other object oriented gaming programs. I think I’m on the right track with one of these methods, but am missing one or two small details, such as the right python command or syntax. Thanks in advance for your input.
guruhunt