Problem with vectorToAngle and camera

SinSquidSinSquid Member, PRO Posts: 135
edited April 2012 in Working with GS (Mac)
Hi everyone :) Love this forum, and usually I always find my answers here or in T-shirt booth`s tutorials, but now I´m really stuck.

Im working on a game with two blobs, that usese vectorToAngle to move when touch. I also have a camera that are moved by sliding with your finger (like angry birds). Everyting works fine untill the actors have moved outside the cameras start posistion. From then the actors can only move left, no matter what. This is super frustrating, and i can`t figure out why?

Heres the project file: http://www.knutgrafisk.com/sinsquid/gamesalad/blobproblem.zip
Can anyone help me with this?

blob1

Feel free to check out how i did the camera, movement, animations, etc... but please do not steal my graphics or sounds, will be working more on theese. Thanx :)

Best Answer

  • JohnPapiomitisJohnPapiomitis Posts: 6,256
    edited April 2012 Accepted Answer
    First off i like the graphics!

    Second you need to add an offset for the camera

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    I haven't been able to figure out the exact problem (although I can only get them to move RIGHT after a short while), but I did notice that after they have moved and hit the ground, clicking/tapping on them makes them fling themselves (e.g. really high velocity.X) to the right. So even though you're wanting swipe-dependent velocity controls for the actors, it's not behaving that way.

    It still happens if I delete the Drag and Camera actors from the scene and add a "Control Camera" behavior to one of your actors.

    Also, if you put a Display Text behavior on your actors set to the VectorToAngle expression you're using, you'll see that the Direction value gets set to near 0 while this is happening.

    Again, I'm not solving anything, but maybe these clues will get you closer to a solution.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You might need to use self.TouchX/Y and self.ReleasedX/Y values to capture where the touch and release points are (via When touch is pressed and When touch is released) and then put those in your VectorToAngle expression. Someone else will have to help with that part... I've seen it in a demo but can't remember where right now.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SinSquidSinSquid Member, PRO Posts: 135
    Oh sorry... i ment RIGHT, (not left). This is so strange. I think I´m missing some constrain attributes rules for the position of the actors or something, but I`ve tried everything I can think of.
  • SinSquidSinSquid Member, PRO Posts: 135
    Thanx guys, i will try this out (tonight, norwegian time), and report the solution if I get this to work. And thanx for the graphic comment, will be working more on this, there will be 3 layers of parallax, more detailed backgrounds, and I´m planning to make the blobs morph into a superblob when they collide.
  • SinSquidSinSquid Member, PRO Posts: 135
    Oh man... I still can`t figure this out. I´ve added a camera offset, but can`t seem to implement it correct in the vectorToAngle. Mabye @SaladStraightShooter or some of the gamesalad people know how to do this?
  • SinSquidSinSquid Member, PRO Posts: 135
    Just figured it out... after hours and hours, it feels like christmas over here.
    The soulution: Added a camere offset (se the video) and then i added this vector to angle code, and it`s now working like a charm :)
    some_text

    Thanx for the help @JohnPapiomitis
  • slinky1988slinky1988 Member, PRO Posts: 89
    Awesome! I also had the same problem and wasn't quite sure how to put it together after following tshirtbooths tutorial. Just wanted to say thanks!
Sign In or Register to comment.