No collision player or AI spider smith character

I uploaded this video, shows what I’ve got, and I edited one playerbar and removed damage him, and left it as damage, so that solve the player bar not working. There is no collision or contact to lower the AI’s health using a bullet to collide with the AI cube16 box in order to load a scene.

If you use bullets as moving objects in the game, you should remember that you can use the ray sensor to register a collision, but remember that in order for the registration to be successful, the length of the beam must be equal to the speed of the bullet. The script is the best way to cope with the logic of the bullet movement
import bge
def bulletMove(cont):
own = cont.owner
speed = own[‘speed’] # float property for motion and ray range
ray = cont.sensors[‘Ray’]
ray.range = own[‘speed’]
if not ray.positive:
own.applyMovement((0.0, -own[‘speed’], 0.0), True)
elif ray.positive:
obj = ray.hitObject
if ‘health’ in obj:
obj[‘health’] -= 5
own.endObject()
You can also use the throw beam from your game camera to determine the collision but the object that the script uses will be the camera.
import bge
def rayShott(cont):
own = cont.owner
start = own.worldPosition
end = own.worldPosition + own.getAxisVect([0.0, 0.0, -50.0])

ray = own.rayCast(end, start, 50, ‘’)
hit = ray[0]
if hit:
if ‘health’ in hit:
hit[‘health’] -= 5
the beam throw will work better when enemies come close to the player since bullet objects even using scripts can fly through the colliders of enemies and not register collisions, the beam from the camera always registers if it hits an object with the desired property

Blockquote
import bge
def bulletMove(cont):
own = cont.owner
speed = own[‘speed’] # float property for motion and ray range
ray = cont.sensors[‘Ray’]
ray.range = own[‘speed’]
if not ray.positive:
own.applyMovement((0.0, -own[‘speed’], 0.0), True)
elif ray.positive:
obj = ray.hitObject
if ‘health’ in obj:
obj[‘health’] -= 5
own.endObject()

So this goes in a text file for the camera, and then the bottom goes where?

import bge
def rayShott(cont):
own = cont.owner
start = own.worldPosition
end = own.worldPosition + own.getAxisVect([0.0, 0.0, -50.0])

ray = own.rayCast(end, start, 50, ‘’)
hit = ray[0]
if hit:
if ‘health’ in hit:
hit[‘health’] -= 5

What happens to the program bricks? This file does work in upbge, I do have it for the game engine.

I’ve got this setup, but it needs structure, so module or script?

And which code is for the bullet and which is for the camera.

For bullet objects movement and detect strike use first script BulletMove this script assign for bullet object, member you need create property speed (float), sensors always and sensor ray to object, bullet in script use direction -Y. If you select secondary script RayShott assign ther for camera and connect sensor mouse left button, for detect collision and substract health you need create health property (integral) for enemy hit box

bullet or camera shott.blend (95.8 KB)
i finish BGE file bullet shot or camera shot this simply example for you, you need look and understand how work scripts because this first path for make game, my advice to you is to read more about writing scripts through python, find and read a book about game development in BGE so you will get more knowledge and use the official BGE API

Unfortunately, I’m not a programmer. The reason I used blender game engine only was before of the all in one, with programming bricks. Especially when there were videos, there still are, but they are basic, and or are detailed for other game mechanics.

I had two blender books, I recycled them. Blah blah, this and then that, programmed for this object, then for that, then that game was cancelled because the game engine was developed long enough.

That file does work in 2.78. Is this for upbge or just the game engine?

This file create in BGE version 2.79 - old version game engine, even in the old version of the game engine, python programming can solve huge problems with a couple of lines of code or completely replace logical bricks if you use object-oriented programming methods

So this file can work in upbge, so the spider file will need that for special effects not possible in the old engine.