Question: How can I determine the place where an actor lands after getting hit?

ZwireZwire Member, PRO Posts: 179

Explanation:

I wanna have an actor stand somewhere on a certain position. After it gets hit with another actor it has to land for example 1 cm behind its previous place and not any further.

Do I have to make an integer and then make an attribute about position?

I cant figure it out.

Any help will be appreciated.

Comments

  • IceboxIcebox Member Posts: 1,485

    @Zwire said:
    I wanna have an actor stand somewhere on a certain position. After it gets hit with another actor it has to land for example 1 cm behind its previous place and not any further.

    if actor1 overlaps or collides with actor2
    interpolate self.position.x to self.position.x -1 in 0.3 seconds ( if you want over a period of time )
    or
    change attribute self.position.x to self.position.x - 1

  • ZwireZwire Member, PRO Posts: 179

    Hi Icebox,

    I dont think thats it. Tried both methods but it did nothing.

    After the player is hit it has to automatically move to a fixed position where it can only be moved when hit again.

    Here a picture of the situation:

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879
    edited April 2016

    @Zwire -- are the fixed positions at equidistant intervals? For example, is each fixed position always 50 pixels apart?

  • IceboxIcebox Member Posts: 1,485

    @Zwire Is this what you mean ?

    I attached a demo in case you want it

  • SocksSocks London, UK.Member Posts: 12,822

    @Icebox said:
    @Zwire Is this what you mean ?

    I attached a demo in case you want it

    Nice ! :)

  • IceboxIcebox Member Posts: 1,485

    @Socks Thanks! :)

  • ZwireZwire Member, PRO Posts: 179

    @RThurman said:
    @Zwire -- are the fixed positions at equidistant intervals? For example, is each fixed position always 50 pixels apart?

    Hi Thurman,

    Thanks for your reply.

    Not necessarily. Its just about 2 random positions I made up.

  • ZwireZwire Member, PRO Posts: 179

    @Icebox said:
    @Zwire Is this what you mean ?

    I attached a demo in case you want it

    Hi Icebox,

    Thats exactly what I meant. Thanks!

    It doesn't seem really fluid when getting knocked back. Is it better to make it animated when getting knocked back?

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
  • IceboxIcebox Member Posts: 1,485

    @Zwire Hello there sorry i just did it the way i prefer it to be , maybe play with the numbers or try other methods when it collides, i really dont know how fluid you would like it to be so it depends on you , I hope you find a solution though .

    @jamie_c Thanks :) !

Sign In or Register to comment.