Help With Finding A Way To Get Chars Chasing Player

Talk about making games.

Help With Finding A Way To Get Chars Chasing Player

Postby PerrySteven » Mon Jan 26, 2015 12:29 am

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.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby schnellboot » Mon Jan 26, 2015 1:06 am

you could set the xvelocity of the monster according to the side the player is at
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby tvz » Mon Jan 26, 2015 9:43 am

To make monster chase the car, you can use MoveTo function. With this function, monster will follow the car with the speed you specify.
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

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

Postby PerrySteven » Mon Jan 26, 2015 10:57 am

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.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby lcl » Mon Jan 26, 2015 12:15 pm

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. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

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

Postby PerrySteven » Tue Jan 27, 2015 12:56 am

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.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby schnellboot » Tue Jan 27, 2015 1:05 am

you would need to program an AI then
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby PerrySteven » Tue Jan 27, 2015 1:07 am

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.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby schnellboot » Tue Jan 27, 2015 1:32 am

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
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby PerrySteven » Tue Jan 27, 2015 3:15 am

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.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby PerrySteven » Tue Jan 27, 2015 3:25 am

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!
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

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

Postby schnellboot » Tue Jan 27, 2015 10:09 am

ok i thought that you need the movement to be in just four directions (up down left right)
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby lcl » Tue Jan 27, 2015 11:38 am

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.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

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

Postby schnellboot » Tue Jan 27, 2015 12:10 pm

maybe this could be something to start with
Attachments
follow.ged
(1.32 KiB) Downloaded 130 times
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby PerrySteven » Wed Jan 28, 2015 12:35 am

schnellboot wrote:maybe this could be something to start with


Wow, thank you very much. Much appreciated.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron