Lucky Lizard asked me about moving objects in discreet steps of one Blender Unit, and I thought I’d share it with the rest of you in case anyone else was wondering. It’s just a simple Logic Brick solution (I generally use Python for this sort of thing, but there’s more than one way to do everything…). I used a boolean property as a switch to detect key presses and limit movement to one Blender Unit per press. Inverse keyboard sensors reset the switch (inverse sensors fire when the case is not true, as in the key is not being pressed).
Nice one Blendenzo
AND Logic Briks only?! Bravo!
I thought, "Well, I’ll press and hold one arrow key to get “TRUE” behavior
and press another one to screw all this… " just to be nasty…well, I’m failed, as usual
Good work
Thank you
Hi blendenzo thanks for the sweet file… could you show your python implementation of it please… so in your logic bricks you are killing the effect of the double sensor firing of the keyboard sensor?
I’ll do the Python later (I’ve got things to do today). You can allow multiple keyboard sensors to fire if you use more than one boolean switch, though. You probably only need two switches (one for left and right, one for up and down) since it is unlikely that the player will want to push left and right at the same time. If you want to allow all keys to be pressed, use four boolean switches (one for each arrow).
For a Chess game this is unpractical, the player can move off the board. (nice chessboard texture BTW)
I personally would use IPO for this… that way you can get a return value for the cursor location easy, and the cursor is locked to only where you have assigned an IPO.
It also would allow for non-matrix playing fields… so you can make a cool 3d chess board like on the ancient 1960’s Star Trek one spock used to groke.
Also you have used Dloc … this will make so that the game creator cannot use collision sensors, nor will it collide with barriers, other pieces…
I only use Dloc for tele-porters, and other things where you want to defeat the collision system. (great for emitters/fountains/particles and other “fluff” non-collision special effects)
Here is a example of how I have done it in the past… rather than a 2D matrix like a chessboard, I made a 3d one…
for a 2d one just erase the Z controller…
The dynamics objects for the example are slightly broken, it was made in 2.42a I think about a year ago… just makes things bounce upon the spawn… the movement still is 100% ok, so have fun.
as usual , this is 100% logic brick goodness
PS, you can use the onscreen menu rather than the keyboard if you want 8)