Ok, so I can make an object move on a keypress using either actual physics or just axis co-ordinates, but what I’m actually trying to do is to make a much more simplistic game, (puzzle style) in which the object block instantly moves a unit in a specified direction when the user presses a key (or on its own as the case may be). How do I do it?
I’d use a property-controlled IPO. Make an IPO animation which jumps one square per frame, and then set it to be associated with a property which controls the position. They key presses can then control the value of the property.
You could store the object coordinates at properties (like Xloc, Yloc, and Zloc) then use python to add to the property numbers and set the coordinates to the property values.
Do a search here for a game/example called something like move one unit, or move 1 unit. Use google, with this site as the sited to search.
There is a great demo for this, it moves on a chekered board.
Hope that helps… I will see if I can find the file name…
The file is called moveOneCoord.blend
The logic goes like this: keypressed is false, then keypress uparrow and dloc 1.0, and keypressed is set to true.
If keypress is set to true then the inverse of the key pressed goes and sets kepressed to false, etc.
But I wonder it that works on very fast machines? Smile.
keyboard sensor ------> and -------> prop: assign: move, 1
property sensor: equal: assign, 1 -------> and ---------> motion actuator (use DLoc)
…^^^^^--------->property: assign: move, 0
give the object an integer property named “move.” Your welcome.
Aha. I trust that these things will work, so I’ll fiddle with it a bit more now when I get some time. Thank you all!
here goes a chess game , PM toomai to give you the link becuase it is dead now , dew to it’s inactivity .
i still have it on my HDD btw
and you may benfit from this method
post number 12 by captin oblivion .