Galera se gostaram do vídeo peço que deixem sei like e comentário, e caso não seja inscrito ainda, SE INSCREVA, haa, e não se esqueça de ativar o sininho para receber notificação dos vídeos novos, grande abraço, vaaaaaaleeeuu faaaaaaloooou…
scripts: destino.py
———————————————————————————————————–
from bge import logic as g, events
import bge
import random as r
from bge import render as r
cont = g.getCurrentController()
o = cont.owner
cena = g.getCurrentScene()
add = cena.addObject
objs = cena.objects
cenas = g.getSceneList()
tc = g.keyboard.events
m = g.mouse.events
sen = cont.sensors
act = cont.actuators
mo = sen[‘mo’]
mlb = m[events.LEFTMOUSE]
hitpos = mo.hitPosition
if mo.positive:
if mlb:
o.position.x = hitpos.x
o.position.y = hitpos.y
logica.py
———————————————————————————————————–
from bge import logic as g, events
import bge
import random as r
from bge import render as r
cont = g.getCurrentController()
o = cont.owner
cena = g.getCurrentScene()
add = cena.addObject
objs = cena.objects
cenas = g.getSceneList()
tc = g.keyboard.events
m = g.mouse.events
sen = cont.sensors
act = cont.actuators
mov = act[‘mov’]
track = act[‘track’]
dest = objs[‘destino’]
if o.getDistanceTo(dest) (maior) 2:
cont.activate(mov)
cont.activate(track)
else:
cont.deactivate(mov)
cont.deactivate(track)
Voir sur youtube