One Sensor - One Script

This is a little test I made with Blender 2.54 Game Engine. :smiley:

http://img693.imageshack.us/img693/415/movablebox.png

Very simple movement example, one sensor and one python script

How to setup

  1. Find an object in your scene

    • Make it Dynamic
    • Check the Actor tickbox
  2. Add a keyboard sensor

    • Activate TRUE level triggering (pulse_mode)
    • All keys
  3. Add a Python script controller

    • Load the update.py script
    • Link Keyboard sensor with the Python controller
  4. Well done you have a movable object

Features

  1. Keyboard input detection
  2. Set linear movement (with WASD keys)
  3. Apply Z rotation (with left or right arrow keys)
  4. Jump with space (quick hack for jumping)

Todo (Known Bugs)

  1. Make moveSpeed or rotationSpeed FPS safe (time-based movement)
  2. Fix the jump mechanism to jump only while touching the ground
    (Explore add a Game Property to the object to track air time)

http://www.sendspace.com/file/t92t3y

Attachments

onesensor_onescript_movablebox.blend (533 KB)

Nice, very useful especially for test blends when I can’t be bothered to set up a character for movement.

Thanks, I am glad it could help :slight_smile:

I found out you can fly in this by continually pressing spacebar :P. Also the gravity isn’t linked to the gravity in the scene settings.
interesting test.

Yep, the jumping is a quick hack (I added it in the last minute, just for fun). :slight_smile: