EMS Forums
Please login or signup to post on the forums.

Join the forum, it's quick and easy

EMS Forums
Please login or signup to post on the forums.
EMS Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

AI issue

2 posters

Go down

AI issue Empty AI issue

Post by Joegernaut Wed Jun 15, 2011 3:49 am

Here's my code!

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
Joegernaut
Corporal
Corporal

Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand

Back to top Go down

AI issue Empty Re: AI issue

Post by Water Chicken Wed Jun 15, 2011 12:14 pm

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.


Last edited by Emanrice on Fri Jun 17, 2011 10:55 pm; edited 1 time in total
Water Chicken
Water Chicken
Lieutenant
Lieutenant

Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana

Back to top Go down

AI issue Empty Re: AI issue

Post by Joegernaut Fri Jun 17, 2011 8:37 pm

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
Joegernaut
Joegernaut
Corporal
Corporal

Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand

Back to top Go down

AI issue Empty Re: AI issue

Post by Water Chicken Fri Jun 17, 2011 8:54 pm

...Did you even read what I said?
Water Chicken
Water Chicken
Lieutenant
Lieutenant

Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana

Back to top Go down

AI issue Empty Re: AI issue

Post by Joegernaut Wed Jun 22, 2011 4:31 am

Just try and fix plox? I'm clueless about those things you said

Joe
Joegernaut
Joegernaut
Corporal
Corporal

Posts : 78
Join date : 2011-04-18
Age : 27
Location : New Zealand

Back to top Go down

AI issue Empty Re: AI issue

Post by Water Chicken Wed Jun 22, 2011 3:57 pm

*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:
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}
Use that instead to for your enemies AI.
Water Chicken
Water Chicken
Lieutenant
Lieutenant

Posts : 254
Join date : 2011-03-22
Age : 24
Location : Chandler, Indiana

Back to top Go down

AI issue Empty Re: AI issue

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum