How to make a enemy stretch it's arm out?

0 favourites
  • 10 posts
From the Asset Store
It's here!
$4.95 USD
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • I want a enemy to stretch it's arm out when it sees the player and whitdraw it rigth afterwards.

    My thoughts about how to do it: The only imaginable way for this to work i can think off to make the arm a seperate part of the enemy that moves out somehow. Since it stretches out it can't be the full size when it's it not stretched out so it's needs to be cropped at that point somehow. The arm could just be a left and rigth moving object but it needs to be connected to the body. Then we need to make the enemy not stretch out thye arm all the time, only when the player get's close enough. How this can work i am not sure of. Like you can see i don't know to make this work so a helpful reply or a link to guide or another topic that explains this would be appreciated.

  • Stretching would be setting the width of the sprite..

    So put the origin of the sprite on the left.

    Pin the sprite to the player using pin-behaviour.

    Give the enemy line-of sight

    Stretch (set the width of) the arm when the enemy has line of sight..

    If you want the arm to point in the direction of the player, you should set it's angle to something like angle(arm.x,arm.y,player.x,player.y)

    If you want it to be better looking, you could change frames of the arm sprite depending on it's width ofcourse..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Stretching would be setting the width of the sprite..

    So put the origin of the sprite on the left.

    Pin the sprite to the player using pin-behaviour.

    Give the enemy line-of sight

    Stretch (set the width of) the arm when the enemy has line of sight..

    If you want the arm to point in the direction of the player, you should set it's angle to something like angle(arm.x,arm.y,player.x,player.y)

    If you want it to be better looking, you could change frames of the arm sprite depending on it's width ofcourse..

    Thanks for the help. I unfortunaley got stuck on the pin part. I have given both the body and the arm the pin behavior. Then whit the arm i made the event is pinned and after that the action is pinned to body. IThen whit the body i made the event is pinned to and after that the action is pinned to arm. The body moves left and rigth so when i turn on the game the body moves like usual but the arm who was supposed to be pinned to body doesn't follow the body and get's stuck in place. I thaugth that the arm also needed to move left and rigth for it to follow the body. So then i made it do that. The arm still doesn't follow the body. I want the arm to always be at one position in contrast to thye body how much the body an moves. Now it doesn't even follow the body and just falls down the ground and stops moving. How don you make the pin behavior work?

  • Only one of the objects needs to have the pin behaviour..

    From the Manual entry about the pin behaviour:

    Simply adding the Pin behavior to an object does not do anything. You must use the Pin action to pin the object to another object.

    So you would need something like this:

    on start of layout

    pin arm to body

  • Only one of the objects needs to have the pin behaviour..

    From the Manual entry about the pin behaviour:

    Simply adding the Pin behavior to an object does not do anything. You must use the Pin action to pin the object to another object.

    So you would need something like this:

    on start of layout

    > pin arm to body

    The manual says something about mode bar. Where can i see that? The pin behavior has no properties. i did make body pin to body at the start of layout. The body still moves whitout the arm and the arm falls to the ground. Again i need to see a succesfull event sheet.

  • Again i would want a event sheet of how this would work.

  • Body pin to body would work if you are trying to pin the body to itself..

    If you want an example of the pin behaviour choose new project inside Construct2 and open the pin-behaviour example..

    It's one of the many examples of behaviours and other possibilities of Construct2 shipped with the program..

  • Body pin to body would work if you are trying to pin the body to itself..

    If you want an example of the pin behaviour choose new project inside Construct2 and open the pin-behaviour example..

    It's one of the many examples of behaviours and other possibilities of Construct2 shipped with the program..

    I did open the pin behavior example and i changed the cog to the body sprite and one of the sheilds to the arm sprite and they finally pin together. It must have been something wrong whit whit the first body and arm. Now i need help whit the stretching part which i not think is documented anywhere. The arm should strtch little by little and reach full width after one second. If you just set in line of sigth and set width to the final width it makes the arm go to it's final width immediatly in one choppy movement. It's supposed to stretch out graudually. You could do this by making it width 70 after 0,15 seconds and width 80 after 30 seconds and so on. The problem is that i don't know how to find a timer that only make a event happen once. X seconds makes a event happen every x seconds but not just one time. Even if i make it all work i don't know how to adjust the appaerance of the arm when it's stretches. The arm should just be wider, not any shorter and the hand shouldn't get wider. How can i make it look good.

  • I made a stretching arm once..

    You could use Timer behaviour

    to have things happen on timer..

    One way would be to set a variable when you want the stretch to happen,

    set the width of your sprite to : sprite.width+1 as long as the variable is set

    and unset the variable after one second on timer.

  • I made a stretching arm once..

    You could use Timer behaviour

    to have things happen on timer..

    One way would be to set a variable when you want the stretch to happen,

    set the width of your sprite to : sprite.width+1 as long as the variable is set

    and unset the variable after one second on timer.

    I did that and it do stretch out it's arm smoothly like it should but it didn't do it when it should. It is supposed to begin stretching out it's arm when it sees the player. It's line of sigth is short so it should only be able to see the player when the player is close to it. When it has seen the player it should stretch out the arm in one second. What really happens is that it stretches out it's arm several seconds after the platyer has came close to it and drags it in and out when the player go to random locations. I hope you understood the problem by all the complexity this reply this answer had. The timer behaviors seem a bit messy. Is there any other thing you can use?

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