GameSalad

Howdy, Stranger!

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

moving problem

holaaa... there is an
actor : MOTION > Linear Velocity X 250
rule > when touch or overlaps whit actor B change attribute "Linear Velocity X" change to "-Linear Velocity X"

it works good so when tha actor A toch actor B come back....

BUT

SOMETIMES the actor crash and touch the actor B and stay in the same position why??????

Comments

  • ThoPelThoPel GermanyPosts: 184Member, PRO
    edited August 2015

    Have you added a display text behavior (or log) to the actor which shows the velocity X? Just for verification, to check if it changed to 0 or remains at 250.

  • Reckless AppReckless App Posts: 47Member, PRO

    change to 0

  • Reckless AppReckless App Posts: 47Member, PRO

    realy i see i like -1.9239248923 ... ad continusly change 2.942384283 number like these

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

    @Reckless App said:
    realy i see i like -1.9239248923 ... ad continusly change 2.942384283 number like these

    When the actor hits the obstacle its linear velocity drops dramatically, you are then asking the actor to make this velocity negative.

  • Reckless AppReckless App Posts: 47Member, PRO

    so how i can make an actor touch another one and come back??

  • SocksSocks London, UK.Posts: 12,822Member
    edited August 2015

    Make an integer attribute ('A') set it to 1 / set Linear Velocity X to 250.

    Rule: When actor collides with obstacle
    --Change A to 1-A
    --Change Linear Velocity X to 250 *((A *2)-1)

  • GameAlchemistGameAlchemist Posts: 106Member

    @Reckless App See the file below. I am guessing thats what you want.

  • Reckless AppReckless App Posts: 47Member, PRO

    @Socks said:
    Make an integer attribute ('A') set it to 1 / set Linear Velocity X to 250.

    Rule: When actor collides with obstacle
    --Change A to 1-A
    --Change Linear Velocity X to 250 *((A *2)-1)

    it works but

    moving 250 ok and then when come back linear velocity is -750

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

    @Reckless App said:
    . . . when come back linear velocity is -750

    You've probably made a mistake when creating the rule.

  • Reckless AppReckless App Posts: 47Member, PRO
  • Reckless AppReckless App Posts: 47Member, PRO
    edited August 2015

    @GameAlchemist said:
    @Reckless App See the file below. I am guessing thats what you want.

    thanks @GameAlchemist but i would like use just one wall 'cuz i'll use lots of level

  • GameAlchemistGameAlchemist Posts: 106Member

    Check this out. Hopefully this method will work. @Reckless App

  • Reckless AppReckless App Posts: 47Member, PRO

    @GameAlchemist said:
    Check this out. Hopefully this method will work. @Reckless App

    the problem is if you put anothor wall in the center and jump over it when come back and touch it don't come back
    hahaha
    is a very simple thing but I can't understand how to fix it : :'(

  • Reckless AppReckless App Posts: 47Member, PRO

    @Socks said:
    Which mistake you thinks i made??

  • GameAlchemistGameAlchemist Posts: 106Member

    Ohhh I get it now, well I tried the method you mentioned in the first post by making it go left if lin vel x is greater than 20 and go right if lin vel x is less than 20. It works but sometimes(just as you mentioned) it doesn't work. And I am also stuck with a similar problem in my project too, instead with a linear velocity Y I want a box to know the force at which the actor is coming and sometimes it doesn't recognise the force.

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

    @Reckless App said:
    Which mistake you thinks i made??

    The first change attribute condition is wrong.

  • Reckless AppReckless App Posts: 47Member, PRO

    @Socks said:
    The first change attribute condition is wrong.

    yeahh... thank you very much....

  • Reckless AppReckless App Posts: 47Member, PRO

    @Socks said:
    The first change attribute condition is wrong.

    In the end is the same thing sometimes the actor
    walk through walls

  • GameAlchemistGameAlchemist Posts: 106Member

    I solved my problem, and this file might do that for you too. All I had to do was increase the drag in the physics panel. @Reckless App

Sign In or Register to comment.