AI issue
2 posters
EMS Forums :: Discussion :: Game Maker :: Questions
Page 1 of 1
AI issue
Here's my code!
Basically what I want it to do is make him jump over obstacles if he's near one.
It works!
but...
When he's beside an obstacle, he only jumps once for some reason and he doesn't make it over any high ones because being close to a wall causes his hspeed to become 0 so he doesn't get stuck, this means he jumps straight up if he's next to a wall.
Joe
- Code:
if place_meeting(x+30,y,Obj_Solid)
{
if !place_free(x,y+1)
{
vspeed = -10
hspeed = 4
}
}
if place_meeting(x-30,y,Obj_Solid)
{
if !place_free(x,y+1)
{
vspeed = -10
hspeed = -4
}
}
Basically what I want it to do is make him jump over obstacles if he's near one.
It works!
but...
When he's beside an obstacle, he only jumps once for some reason and he doesn't make it over any high ones because being close to a wall causes his hspeed to become 0 so he doesn't get stuck, this means he jumps straight up if he's next to a wall.
Joe
Joegernaut- Corporal
- Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand
Re: AI issue
I suggest waiting until the enemy is colliding with the wall instead.
As for him not jumping high enough, I'd have to see the code that makes him move and stuff.
By the way, when are you gonna start doing graphics again?
EDIT: Maybe I should make a platforming engine and post it here for people to use.
As for him not jumping high enough, I'd have to see the code that makes him move and stuff.
By the way, when are you gonna start doing graphics again?
EDIT: Maybe I should make a platforming engine and post it here for people to use.
Last edited by Emanrice on Fri Jun 17, 2011 10:55 pm; edited 1 time in total
Water Chicken- Lieutenant
- Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana
Re: AI issue
oops, I forgot about graphics, I'm busy this weekend so I can't do atm.
Erm, I'll give you dl link:
http://www.mediafire.com/?b6g5atg00kymdsl
Erm, I'll give you dl link:
http://www.mediafire.com/?b6g5atg00kymdsl
Joegernaut- Corporal
- Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand
Re: AI issue
...Did you even read what I said?
Water Chicken- Lieutenant
- Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana
Re: AI issue
Just try and fix plox? I'm clueless about those things you said
Joe
Joe
Joegernaut- Corporal
- Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand
Re: AI issue
*sigh*... Really?
Checking if the object is colliding with an object as in only checking 1 pixel beside it, not 30.
And I suggest just change the x position of the enemy and not to use hspeed.
Like so:
Checking if the object is colliding with an object as in only checking 1 pixel beside it, not 30.
And I suggest just change the x position of the enemy and not to use hspeed.
Like so:
- Code:
if place_free(x+4,y) and oPlayer.x > x{x += 4}
if place_free(x-4,y) and oPlayer.x < x{x -= 4}
if ! place_free(x+4,y) and ! place_free(x,y-1){vspeed = -10}
if ! place_free(x-4,y) and ! place_free(x,y-1){vspeed = -10}
Water Chicken- Lieutenant
- Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana
EMS Forums :: Discussion :: Game Maker :: Questions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|