Page 1 of 1

Enemy System?

PostPosted: Thu Jun 16, 2011 1:27 pm
by Wertyboy
PLEASE...... someone help me:
Enemy:
- Random Movement (with timing punch, timing jump)
- Move to Player when touch the screen (without flying)
- Change Animation when move left, right
:)

Re: Enemy System?

PostPosted: Thu Jun 16, 2011 4:41 pm
by Jagmaster
Take a look at Bee-ant's "Fighting demo, Ize"

Re: Enemy System?

PostPosted: Thu Jun 16, 2011 5:38 pm
by Wertyboy
Jagmaster wrote:Take a look at Bee-ant's "Fighting demo, Ize"

- Move to Player when touch the screen (without flying)

Re: Enemy System?

PostPosted: Fri Jun 17, 2011 11:37 am
by Wertyboy
I'm not kidding. i really need help for my Stickman The Isane Warrior

Re: Enemy System?

PostPosted: Fri Jun 17, 2011 12:24 pm
by Jagmaster
I've actually been working on trying to figure that out myself. You want an enemy to jump to the player's platform right?
I know the first thing to do would be setting the actor to "Receive events out of view -> no"
As I said, I'm having problems with this myself, but here is what I have so far.
Code: Select all
if(yvelocity>=5)
{
P2Canjump=0;
}
if (yvelocity<14)
{
yvelocity+=gravity*2;
}
//------------------------------------------------------------------->
if(Player_State==1)
{


if(x<=player.x-15)//-----------------------Stand------->
{
    P2dir=1;
}
if(x>=player.x+15)
{
    P2dir=-1;
}
if(x<=player.x-50)//--------------------------Walk------->
{
    P2dir=2; x+=speed

}
if(x>=player.x+50)
{
 
    P2dir=-2; x-=speed;
}
if(player.y<y-100&&P2Canjump==1)
{
yvelocity-=jump;
P2Canjump=0;
if(P2dir==2||P2dir==1)
{
    xvelocity=speed;
}
if(P2dir==-2||P2dir==-1)
{
    xvelocity=-speed;
}
}
}

This won't work unless you add the proper variables.
What it does, is if the player is to the left and higher, the enemy will jump left.
Same the other way around.

I still need to figure out how to make an actor choose the nearest platform (maybe a distance function?)

Anyways, hope it helps at least a little. :?

Re: Enemy System?

PostPosted: Sun Jun 19, 2011 12:55 am
by Wertyboy
Well... im stuck in Timer

Re: Enemy System?

PostPosted: Sun Jun 19, 2011 1:22 pm
by Jagmaster
Alright, if you want to do it with timers,
on your timer, you have :
Code: Select all
xvelocity = xvelocity - 1;



instead:
Code: Select all
xvelocity = -4;

replace 4 with your speed.
on right timer:
Code: Select all
xvelocity = 4;

Re: Enemy System?

PostPosted: Sun Jun 19, 2011 5:03 pm
by Wertyboy
Jagmaster wrote:Alright, if you want to do it with timers,
on your timer, you have :
Code: Select all
xvelocity = xvelocity - 1;



instead:
Code: Select all
xvelocity = -4;

replace 4 with your speed.
on right timer:
Code: Select all
xvelocity = 4;

ohohohohoh thx

Re: Enemy System?

PostPosted: Sun Jun 19, 2011 6:33 pm
by Wertyboy

Re: Enemy System?

PostPosted: Wed Jun 22, 2011 2:21 am
by Jagmaster
You have
Code: Select all
ehp= ?number
if(ehp==0)
{
//blah
}

you should have
create actor:
Code: Select all
ehp= whatever

draw actor:
Code: Select all
if(ehp==0)
{
//die
}

Re: Enemy System?

PostPosted: Wed Jun 22, 2011 4:54 am
by Wertyboy
work!
now..... if i use gravity script (with Physical Response 1101 to tiles).. enemy will stuck (timer is work, but they can't walk left right)

Re: Enemy System?

PostPosted: Wed Jun 22, 2011 5:27 am
by skydereign
Yeah, there are two fixes. A lot of the time enemies don't have to interact with y as they are always on the same platform. So first solution is to place enemies where they don't fall off. The second is to use the enemy's draw actor event instead of xvelocity.
enemy -> Draw Actor -> Script Editor
Code: Select all
x+=dir*4;

Setting dir to 1 makes the enemy move right, and setting it to -1 makes it move left.