Help Please- 3 questions: 2 about update, 1 constrain

outasiteoutasite Member Posts: 417
edited November -1 in Working with GS (Mac)
- I'm stuck on being able to constrain my actor to my mouse x & y, and then also not allowing it to go outside of the screen.
- For example: follow my touch, but when I get to the edge of the screen leave a 10 pixel buffer from edge.
- I have the follow mouse, but not the 'buffer'.

Update Issues
1) overlap / collide seems to not be working. Any one else have this happen?
2) create to scene, create new actor, delete actor, and actors on scene do not update unless I leave the scene and return back.

Thanks in advance.

Comments

  • SkyMapleSkyMaple Member Posts: 817
    outasite said:
    As title said. I'm stuck on being able to constrain my actor to my mouse x & y, and then also not allowing it to go outside of the screen.

    For example: follow my touch, but when I get to the edge of the screen leave a 10 pixel buffer from edge.

    I have the follow mouse, but not the 'buffer'.

    Thanks in advance.

    This wont happen on an iphone/ipad

    otherwise make an invisible actor that covers the entire camera but nothing else. Make a new attribute called "touch inside?".On that actor put-

    Rule if touch is inside-

    change attribute "touch inside?" to true

    otherwise

    false

    On the actor that you are constraining to touch put

    Rule if attribute "touch inside?" is true-

    constrain position X,Y to touch X,Y
  • outasiteoutasite Member Posts: 417
    Thank you! I'll test it right now.
    Also, let this count as a bump. (I added to other parts to my post. Didn't see a need in making a whole new post)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    try this if skymaples sugestion doesnt work

    Make a interger attribute called moveon and set it to 0

    have a rule in the actor you want to drag around wen touch is pressed change moveon to 1
    then in the otherwise section of that rule have a change attribute buehavior changing moveon to 0

    have another rule when attribute moveon=1
    constrain self position x to mouse position x
    constrain self position y to mouse position y

    next make a new actor call it buffer wall or whatver, set the alpha to zero, and have it set up liek walls around the edge of the screen where you want the actor to stop moving when you touch it

    and lastely go back into the actor that you drag around and where you put the other rules, and make one more rule and have it when actor overlaps or collides with actor of type bufferwall
    then in that rule change attribute moveon to 0

    hope that helps
  • outasiteoutasite Member Posts: 417
    John, I cannot do it your way, for some reason GS .9.3 does not recognize when a overlap or collision occurs for me.

    Tested by:
    (Enemy) Rule-> If overlap or collide with actor of type 'bullet'
    >> destroy

    and shot enemy 500 times. and nothing.
  • mangaroomangaroo Member Posts: 419
    that is pretty worrying...i would try a clean reinstall, use something like appzapper
  • outasiteoutasite Member Posts: 417
    Okay update:

    Fixed the buffer. Made a actor that covered whole screen and constrained (records) 2 values. PlayerX and PlayerY.
    Then in my "Hero" actor constrain it to PlayerX and PlayerY. If PlayerX is > or < buffer zone then constrain it to the buffer. Same is the Y.

    As for the Overlap / Collide. Still nothing. Initially I had both actors set to not movable and interpolate them. Nothing happened. Then when I set one to moveable it works. Has it always been like this? I do not remember it being so.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yes one of them has always had to be moveable for collide to register
  • outasiteoutasite Member Posts: 417
    Alright then. Thank you.
Sign In or Register to comment.