def _drawMarker(self):

        #check for selected_flag and draw marker if needed
        if self.markerFlag:
            delta = Vector((0, 0, 1))
            delta.magnitude = 2.5
            render.drawLine(self.worldPosition, self.worldPosition + delta,
                            [255, 0, 0])
    def main(self):
        #k = keyDown
        k = self.user.keyboard.keyDown

        up_down = k(events.UPARROWKEY) - k(events.DOWNARROWKEY)
        right_left = k(events.RIGHTARROWKEY) - k(events.LEFTARROWKEY)

        delta = Vector((right_left, up_down, 0))
        delta.magnitude = self.speed

        self.worldPosition += delta
 def main( self ):
     
     k = self.user.keyboard.keyDown
     
     up_down = k( events.UPARROWKEY ) - k( events.DOWNARROWKEY )
     right_left = k( events.RIGHTARROWKEY ) - k( events.LEFTARROWKEY )
     
     delta = Vector( ( right_left, up_down, 0 ) )
     delta.magnitude = self.speed
     
     self.worldPosition += delta
from bge import logic as GameLogic
from mathutils import Vector
c = GameLogic.getCurrentController()
own = c.owner

space = 0.003

# sensors
ray = c.sensors["ray"]

# actuator
spawn = c.actuators["spawn"]

if ray.positive:
    # Get info
    pos_vec = Vector(ray.hitPosition)
    normal_vec = Vector(ray.hitNormal)

    # make object
    spawn.instantAddObject()
    bullet_hole = spawn.objectLastCreated

    # position hole
    bullet_hole.alignAxisToVect(normal_vec.xyz, 2, 1)
    normal_vec.magnitude = space
    bullet_hole.worldPosition = (pos_vec + normal_vec).xyz