[Solved] Different Times In The Same Object

I want an enemy just like Ghost but instead of Teleporting, it will dash to the current position of the Player that’s why I want to get the Player’s X and Y position. It only stops (force is permanent) when it collides to a Wall (I have 4 objects called WallLeft, WallRight and so on that’s why I also need to specify what object will it collide on. Then it will resets the timer and start again.

By the way, I already created events for the Ghost and this enemy “Ram” and it’s working perfectly until I tested two or more of it and saw that it isn’t working when two or more of that same object are in field that’s why I created this “How do I”.

So, you want that enemy to:
Go towards Player with permanent force which will be nullified after you collide with something you specify

Is this right?
And is that timer for cooldown?

Edit: You also need to make another behavior

1 Like

Yup! It’s like the enemy in most of games where it dashes through the current location of the player then when collides to a wall, it stops. But in addition to that, after the collision, it will have a random force so that it will move randomly. Just like the Ghost that after they teleport they chase the player but instead of chasing them before the timer comes, it will move randomly and bounces off wall with the help of “bounce” function behavior.

Here’s the original events I’ve made that’s working perfectly fine when the object is only one.


You can create a Custom Action with some Parameters

Parameters:
PosX For X Position to dash
PosY For Y Position to dash
Speed For Speed
Make these Parameters as a number

Now in the events:
Add a for to Object towards GetArgumentAsNumber(“PosX”); GetArgumentAsNumber(“PosY”) at a speed of GetArgumentAsNumber(“Speed”)

GetArgumentAsNumber gets the value of Parameters

I am going for dinner, after that, we will discuss more.

Why don’t you add all the walls to a group? the check collision EnemyRan is in collision with WallsGroup

1 Like

Here’s the project: PR - Google Drive again to see how the Ram works just put only one Ram object to make sure it works fine.

I already have events with that. But when I put it in custom function behavior there’s only “object” on it and nothing else.

You can pass groups to a function but you need to create the group into the function. anyway if you find more easy to use objects is fine.
I’ll check the Ram project later and tell you something.

1 Like

You need to add Parameters


then choose its object type

1 Like

Thanks! hope you can fix my problem!

Can I put there other objects like the “Player” and my walls object?
I can’t find where I put that. I’m sorry I’m new to custom behaviors.