Platform beatemup game questions2

0 favourites
  • 12 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • 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"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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" ?

  • you will have to describe the instructions in a little more detail I'm afraid. I am very new at this.

  • 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 :)

  • Thanks graffanim8r. See if you can figure out what justifun instructed for question 1. Appriciate it heaps

  • 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!

  • 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

  • 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?

  • 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)

  • thanks graffanim8r, but could you download the file, change it according to justifun's instructions and send it back to me please?? if you don't have dropbox, please feel free to send it to my email: zhaholhmm@hotmail.com

  • Tweaked the file and emailed it back to you.

    I've added a "sightrange" variable to the TUSK object (this is the range that the enemy will be able to see before attacking.

    then within that range, he will play the attack animation

    you will need to try and figure out how to do damage now to the player. Give it a try and report back if you need any help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)