Help with golf game please
jay2dx
Member Posts: 611
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
Comments
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?
Age of Dominion RTS for iOS
Age of Dominion RTS for Android
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.
Thanks @socks will give it a go
@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.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline thanks for this, will keep at it, really thanks so much for the help guys
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