Platform beatemup game questions2

Get help using Construct 2

Post » Fri Nov 02, 2012 10:17 am

I am making a Platform beat em up game.
And I have a few more problems:

(Project file download link:



1. I want the Enemy to attack from a little distance , Including overlaping the player completly.

2. I don't want the enemy to simulate Jumping When the Player Jumps. I just want the enemy to keep moving normally.



Controls:
Move with "left" and "right arrow keys".
Jump with "up arrow key".
Jump extra high Holding "Shift" while jumping.
Hit with "D key"
Last edited by meman on Sat Jul 05, 2014 6:56 pm, edited 1 time in total.
B
5
Posts: 43
Reputation: 403

Post » Fri Nov 02, 2012 2:21 pm

To have the enemy attack from a distance you need use the distance() expresssion

distance(x1, y1, x2, y2) Calculate distance between to points

so in your case

system - every tick - compare distance(player.x, player.y, enemy.x, enemy.y) < 20
----do actions


2)
For the enemy characters turn off the property "has control" if you are using the platform behavior on it.

B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Nov 02, 2012 2:35 pm

I don't follow after system-every tick. How do I get the compare distance?   and is "----do actions" a part of the formula?


2) How do I turn off the property "has control" ?
B
5
Posts: 43
Reputation: 403

Post » Fri Nov 02, 2012 5:57 pm

you will have to describe the instructions in a little more detail I'm afraid. I am very new at this.meman2012-11-02 17:58:38
B
5
Posts: 43
Reputation: 403

Post » Fri Nov 02, 2012 6:33 pm

I'll have to look into the first question, but for the second it's very simple.

Assuming you have the platform behavior on the enemy all you have to do is select your enemy sprite, go into the properties panel on the left, in the behaviors properties under platform, you'll see Contol: Default: "Yes". Click on it and change it to "No".

that should do it :)
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 7:32 pm


Thanks graffanim8r. See if you can figure out what justifun instructed for question 1. Appriciate it heaps
B
5
Posts: 43
Reputation: 403

Post » Fri Nov 02, 2012 8:57 pm

ok I think I see what he's talking about and that should be pretty straight forward too:) I'm at work so I can't open up construct right now but when I get home tonight I'll upload an example for ya!
...and artistic hocus pocus that will leave you up in smoke!
B
11
S
1
Posts: 12
Reputation: 1,881

Post » Fri Nov 02, 2012 9:01 pm

Here's a follow up.

1) Create a instance variable for the enemy called "sightrange" - give it a default value like 20 (in the properties field on the left)

2) add new event
type: system
"every tick"

for the action choose "enemy sprite" - set value
Then in the next dialog box pick your variable "sight range"

Now create a new event
system - compare instance variable

pick "sight range"
and change the expression to "<" (less than)
and where it says 0 right now, change it to distance(self.x, self.y, player.x, player.y)

substitute "player" for whatever your called your player sprite.

Then in the action for this new event put something like "set animation" to "attack"

or whatever you want your enemy to do when the player is close

now each time the player gets with whatever "sight range" default value you give it, it will execute those actions
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Nov 02, 2012 10:04 pm

Thanks for the great instructions, but I'm stuck at the third point. You said:

-Now create a new event
system - compare instance variable. ( to me it says Compare variable under Global and Local variables)

-pick "sight range" : But i can't pick "sight range" for some reason.. It is very strange


- In the formula: distance(self.x, self.y, player.x, player.y)

I replace Player with the player sprite, that's clear. But what about "self" do I change that, or do I leave it as it is?meman2012-11-02 22:05:15
B
5
Posts: 43
Reputation: 403

Post » Fri Nov 02, 2012 10:15 pm

On: -Now create a new event
system - compare instance variable. Did you mean:    event: enemysprite- compare instance variable?

I can't make it work. Could you download my file, change it and send it back please? It would be of great help! (keep the distance of the enemy at 2 centimeters for example)
B
5
Posts: 43
Reputation: 403

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests