Enemy System?

Talk about making games.

Enemy System?

Postby Wertyboy » Thu Jun 16, 2011 1:27 pm

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
:)
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Jagmaster » Thu Jun 16, 2011 4:41 pm

Take a look at Bee-ant's "Fighting demo, Ize"
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Enemy System?

Postby Wertyboy » Thu Jun 16, 2011 5:38 pm

Jagmaster wrote:Take a look at Bee-ant's "Fighting demo, Ize"

- Move to Player when touch the screen (without flying)
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Wertyboy » Fri Jun 17, 2011 11:37 am

I'm not kidding. i really need help for my Stickman The Isane Warrior
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Jagmaster » Fri Jun 17, 2011 12:24 pm

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. :?
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Enemy System?

Postby Wertyboy » Sun Jun 19, 2011 12:55 am

Well... im stuck in Timer
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Jagmaster » Sun Jun 19, 2011 1:22 pm

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;
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Enemy System?

Postby Wertyboy » Sun Jun 19, 2011 5:03 pm

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
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Wertyboy » Sun Jun 19, 2011 6:33 pm

User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby Jagmaster » Wed Jun 22, 2011 2:21 am

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
}
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Enemy System?

Postby Wertyboy » Wed Jun 22, 2011 4:54 am

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)
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: Enemy System?

Postby skydereign » Wed Jun 22, 2011 5:27 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron