Help with golf game please

jay2dxjay2dx Member Posts: 611
edited January 2016 in Working with GS (Mac)

Hi guys, hoping someone can help, please see attached image for what I'm trying to do, basically a 2d golf game with touch and drag aiming mechanic, and on release the ball is shoot in the released direction,

Regarding the ball shoot mechanic I've tried using accelerate to, change volecty using vector to angle based on the touch release location etc I just can't get it to work well,

Would love to hear your thoughts and hopefully get some help,

Image

http://postimg.org/image/g7y2oqcrd/

Comments

  • JScottJScott Member Posts: 143

    Looks like angry birds or cannon type physics, which there are tutorials and templates for. But, looking at your sketches, it looks like you are actually dragging your finger to where you want the ball to land? Instead of dragging back for angle and power and then releasing. Is that correct?

  • jay2dxjay2dx Member Posts: 611
    edited January 2016

    thanks for the reply, kind of, but no the drag is for the angle and power the ball will go much further than where the finger is,

    my biggest problem is that it doesn't work once you let the ball control the camera! like angry birds you shoot from the start every time, if i shoot the ball and it lands say halfway down the scene, i.e. X +2000 within a scene of say X 6000, the power and angle is way off when you attempt to make your second shot from where the ball landed! and the ball won't shoot towards the drag and release target correctly

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

    @jay2dx said:
    thanks for the reply, kind of, but no the drag is for the angle and power the ball will go much further than where the finger is,

    my biggest problem is that it doesn't work once you let the ball control the camera! like angry birds you shoot from the start every time, if i shoot the ball and it lands say halfway down the scene, i.e. X +2000 within a scene of say X 6000, the power and angle is way off when you attempt to make your second shot from where the ball landed! and the ball won't shoot towards the drag and release target correctly

    Add camera origin X and camera origin Y to your equation.

  • jay2dxjay2dx Member Posts: 611
    edited January 2016

    Thanks @socks will give it a go :)

  • jay2dxjay2dx Member Posts: 611

    @Socks tried a few things but can't seem to get an X and Y reading from anything larger than the initial screen size, i.e. after the ball travels past x 1024 the mouse x location does not read further along the x axis! tried ticking scrolling screen and none but no luck! I'm stumped, o well :( going to keep at it though. so thanks

  • ArmellineArmelline Member, PRO Posts: 5,368

    @jay2dx said:
    @Socks tried a few things but can't seem to get an X and Y reading from anything larger than the initial screen size, i.e. after the ball travels past x 1024 the mouse x location does not read further along the x axis! tried ticking scrolling screen and none but no luck! I'm stumped, o well :( going to keep at it though. so thanks

    The touch X/Y and mouse X/Y will always correspond to the screen, with 0,0 being bottom left. The ball position X/Y will correspond to the X/Y position on the scene (not the screen). As such, you need to "convert" one to the other. The "screen" X/Y (the mouse/touch etc.) will be the camera.origin.X/Y position plus the screen X/Y position. So you need to either unlock your ball actor and include camera.origin.X/Y in your calculations, or you need to unlock another actor and constrain the camera.origin.X/Y to game attributes.

  • jay2dxjay2dx Member Posts: 611

    @Armelline thanks for this, will keep at it, really thanks so much for the help guys :)

  • jay2dxjay2dx Member Posts: 611
    edited January 2016

    OMG I've done it :0

    THANK YOU GUYS this has taken me all day head scratching haha

    heres a link to video:

    https://youtu.be/EXIclZz38UQ

Sign In or Register to comment.