This is blood hit display
from bge import logic
import random
cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner
if own['blood'] > 0:
own['blood'] -= 1
own.applyRotation([0.0, 0.0, (random.randint(0, 90))])
scene.addObject("blood splat", own, 10)
if own['blood'] == 1 or own['blood'] == 2:
scene.addObject("bloodmist", own, 30)
And the following is blood display
from bge import logic
cont = logic.getCurrentController()
scene = logic.getCurrentScene()
own = cont.owner
#messages
msg1 = cont.sensors['noblood']
msg2 = cont.sensors['80+']
msg3 = cont.sensors['60+']
msg4 = cont.sensors['40+']
msg5 = cont.sensors['20+']
msg6 = cont.sensors['0+']
#bloodspawn
blood1 = cont.actuators['1']
blood2 = cont.actuators['2']
blood3 = cont.actuators['3']
blood4 = cont.actuators['4']
blood5 = cont.actuators['5']
#endobjects
end1 = cont.actuators['end1']
end2 = cont.actuators['end2']
end3 = cont.actuators['end3']
end4 = cont.actuators['end4']
end5 = cont.actuators['end5']
#spawning in blood
if msg1.positive:
cont.activate(end1)
cont.activate(end2)
cont.activate(end3)
cont.activate(end4)
cont.activate(end5)
if msg2.positive:
cont.activate(blood1)
cont.activate(end2)
cont.activate(end3)
cont.activate(end4)
cont.activate(end5)
if msg3.positive:
cont.activate(blood2)
cont.activate(end1)
cont.activate(end3)
cont.activate(end4)
cont.activate(end5)
if msg4.positive:
cont.activate(blood3)
cont.activate(end1)
cont.activate(end2)
cont.activate(end4)
cont.activate(end5)
if msg5.positive:
cont.activate(blood4)
cont.activate(end1)
cont.activate(end2)
cont.activate(end3)
cont.activate(end5)
if msg6.positive:
cont.activate(blood5)
cont.activate(end1)
cont.activate(end2)
cont.activate(end3)
cont.activate(end4)
I append the blood controller empty, so it includes it when I loaded it into my game file.
I don’t know how to get it to work in my file.
I don’t know how to link, so when the AI crashes into the player, that loads the effect.
Thank you.