Collision to send object to a player

Hi,

This is an interesting idea.

Collision And Edit object bricks, so add in an object to create a correct time to get an object to find the player.

I think that seems a good option, if Ray or Radar don’t work out as straightforward as they should be

That won’t work unless it is one object, not two which are not joined.

Near And Steering

So 10,000 for player distance, and 1.900 for reset. That doesn’t work.

I’m stuck with Always, which isn’t useful for the objects I need to move at a certain point.

One idea could work for my object.

I removed a block object once the player collides with an object?

How do I do this? :roll_eyes:


So the object is in another location I want to remove that, I use it as a block for AI.

Thanks

You get the last collided object by using KX_CollisionSensor.hitObject().

import bge

def Player(self):

  if self.sensors["Collision"].positive:
    self.sensors["Collision"].hitObject.endObject()

I don’t know, I can’t program.

So I have never used the bricks beyond Always and Near a few times with my old files.

If I don’t use this as an option, the AI can still attack the player from behind a wall or door. So one option is to put a block in place.

This program brick setup should be what I’ve after, is it correct?

I can use bricks on the objects, even though they are using python code programs, they shouldn’t cause any problems.

So player moves forward W, collides with object, and object moves, so Ai can seek player. :slightly_smiling_face:

removeblockobjectandAiseekplayerbricks.blend (416.6 KB)

Looking at the file, it seems all the objects are “static” physics type. If I recall correctly, Static physics objects don’t “feel” any collisions so you may need to use dynamic or sensor (which can feel collisions, even if with a static object).

Also, could you clarify exactly what you are trying to do? I’m a little confused.

The is about removing an object which simply stops the object from going to the player, so the collision object would remove the object blocking the other object from moving to the player object.

I can’t use the AI to simply find the player at a distance once nearby, so just keep everything as is, but use a object to keep the AI at one location until it is removed, and the steering brick does it’s task going to the player.

May be this is better, so once the player collides with the object the block is removed, so in order to create a particular encounter, this is one solution to making it work.

So is the alternative python code?

Here is your above file without blocking brick, but the player and ai are dynamic.
The ai doesn’t seek until the player is in radar reach.
removeblockobjectandAiseekplayerbricks.blend (485.7 KB)

In the actual game file the AI is dynamic.

Radar And steering
Always Action

This should get the Ai to only move when the player is near by.

The other two bricks connected.