GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

ZwireZwire Posts: 165Member, BASIC

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 Posts: 1,483Member

    @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 Posts: 165Member, BASIC

    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 Posts: 2,827Member, Sous Chef, PRO
    edited April 2016

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

  • IceboxIcebox Posts: 1,483Member

    @Zwire Is this what you mean ?

    I attached a demo in case you want it

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

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

    I attached a demo in case you want it

    Nice ! :)

  • IceboxIcebox Posts: 1,483Member

    @Socks Thanks! :)

  • ZwireZwire Posts: 165Member, BASIC

    @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 Posts: 165Member, BASIC

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

  • IceboxIcebox Posts: 1,483Member

    @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.