예제 #1
0
파일: teleport2.py 프로젝트: ciphermaven/pi
	def run(self):
		handle_events(set_start)
예제 #2
0
파일: teleport2.py 프로젝트: szlwzl/pi
 def run(self):
     handle_events(set_start)
예제 #3
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# https://github.com/coderdojobelfast/pi.git

import mcpi.block as block

# import our module!
from sword import handle_events

# Uses the 'sword' module, and builds a small tower of blocks
# on each sword hit, a couple of paces to the east of the player.

def build_tower(mc, pos, block) :
	mc.setBlock(pos.x+2, pos.y, pos.z, block)
	mc.setBlock(pos.x+2, pos.y+1, pos.z, block)
	mc.setBlock(pos.x+2, pos.y+2, pos.z, block)

def build_tower_beside_me(mc, hit):
	print("hit at: " + str(hit.pos) + ", face: " + str(hit.face))
	mc.postToChat("Shazam!")
	pos = mc.player.getPos()
	build_tower(mc, pos, block.STONE)

handle_events(build_tower_beside_me)