Page 1 of 1

Help With Finding A Way To Get Chars Chasing Player

PostPosted: Mon Jan 26, 2015 12:29 am
by PerrySteven
Hello, I am quite new to Game Editor, and I have decided to return to it because I have gained more proficiency in C programming.

I am working on a game with some chase scenes, you know, the usual monster chasing the player thing. But the problem is, I am having real trouble trying to get the Monster char to follow the player. I don't know just how to do it. Of course I could use paths, but laying paths along the entire game would really be tedious.

It would be much appreciated if anyone could help me with this.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Mon Jan 26, 2015 1:06 am
by schnellboot
you could set the xvelocity of the monster according to the side the player is at

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Mon Jan 26, 2015 9:43 am
by tvz
To make monster chase the car, you can use MoveTo function. With this function, monster will follow the car with the speed you specify.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Mon Jan 26, 2015 10:57 am
by PerrySteven
tvz wrote:To make monster chase the car, you can use MoveTo function. With this function, monster will follow the car with the speed you specify.


But... That is only in a fixed position.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Mon Jan 26, 2015 12:15 pm
by lcl
PerrySteven wrote:
tvz wrote:To make monster chase the car, you can use MoveTo function. With this function, monster will follow the car with the speed you specify.


But... That is only in a fixed position.

You can use MoveTo to make your actor follow another actor, not to just move to a fixed position. But using MoveTo may not be your best alternative. What you should do really depends on your game. Is it a sidescroller or a top-down-view game, and in what directions the player can move, should the monster be able to follow past any possible obstacles, etc. You need to provide more information about your setup if you want to receive more detailed help. :)

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 12:56 am
by PerrySteven
lcl wrote:
PerrySteven wrote:
tvz wrote:To make monster chase the car, you can use MoveTo function. With this function, monster will follow the car with the speed you specify.


But... That is only in a fixed position.

You can use MoveTo to make your actor follow another actor, not to just move to a fixed position. But using MoveTo may not be your best alternative. What you should do really depends on your game. Is it a sidescroller or a top-down-view game, and in what directions the player can move, should the monster be able to follow past any possible obstacles, etc. You need to provide more information about your setup if you want to receive more detailed help. :)


Alright, my game will be a top down view, similar to this:
Image

What I want is to have the monster avoid obstacles and follow the player anywhere he/she goes. I think it would be fairly easy to put in a command to stop the chase. The player can move left, right, up, and down.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 1:05 am
by schnellboot
you would need to program an AI then

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 1:07 am
by PerrySteven
schnellboot wrote:you would need to program an AI then


Well sorry but I don't really understand what I should do? Program an AI? How... Please show me an example of code or something.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 1:32 am
by schnellboot
i dont have an example, but if you want to do it on your own you would need some knowledge in programming
first you should write the code for he basic movement and then add detection for obstacles

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 3:15 am
by PerrySteven
schnellboot wrote:i dont have an example, but if you want to do it on your own you would need some knowledge in programming
first you should write the code for he basic movement and then add detection for obstacles


Well to be honest, this is hardly helping me at all. I know how to add movement for the player, what I really want to know is how to get a character to chase the player anywhere he/she goes.

I tried using the MoveTo function, by having the fields inputed with variables which coorelate to the player's x and y positions, the Script editor came with no errors, but when I ran it in game mode, it didn't work for some reason.

By the way, I did have the MoveTo function activated by a trigger.

So now, I don't know, I have no idea where to go from there. I checked the list of functions, but I saw nothing to help me.

My only idea is maybe to create a custom MoveTo function, but that will take some thought...

For now, I am wondering whether there are any methods which don't dig down to the main bone of the game.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 3:25 am
by PerrySteven
PerrySteven wrote:
schnellboot wrote:i dont have an example, but if you want to do it on your own you would need some knowledge in programming
first you should write the code for he basic movement and then add detection for obstacles


Well to be honest, this is hardly helping me at all. I know how to add movement for the player, what I really want to know is how to get a character to chase the player anywhere he/she goes.

I tried using the MoveTo function, by having the fields inputed with variables which coorelate to the player's x and y positions, the Script editor came with no errors, but when I ran it in game mode, it didn't work for some reason.

By the way, I did have the MoveTo function activated by a trigger.

So now, I don't know, I have no idea where to go from there. I checked the list of functions, but I saw nothing to help me.

My only idea is maybe to create a custom MoveTo function, but that will take some thought...

For now, I am wondering whether there are any methods which don't dig down to the main bone of the game.


Oh wait, well for some reason I tried the methods I have been using previously before and it worked! Hmm... Must be a bug, so now I have to find out why!

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 10:09 am
by schnellboot
ok i thought that you need the movement to be in just four directions (up down left right)

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 11:38 am
by lcl
schnellboot wrote:ok i thought that you need the movement to be in just four directions (up down left right)

That also can be achieved using MoveTo. One would just have to execute the actual MoveTo on an invisible guide actor, and make it stop moving whenever it changes direction, and then make the monster move to that position, and then let the guide actor move again, and then just keep repeating that cycle. Of course it's not exactly that simple, but that would be the basic idea I'd start working on.

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Tue Jan 27, 2015 12:10 pm
by schnellboot
maybe this could be something to start with

Re: Help With Finding A Way To Get Chars Chasing Player

PostPosted: Wed Jan 28, 2015 12:35 am
by PerrySteven
schnellboot wrote:maybe this could be something to start with


Wow, thank you very much. Much appreciated.