• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps touch + shoot & collision help

akkkki

Lurker
hi,

I really need help. I am making a game app for my final year project. It is a simple game where you have to shoot a ball into a target by rebounding of walls or angled blocks. However i need help in 2 areas:

1) the shooting mechanism is similar to that of stupid zombies. There is a crosshairs where you touch on the screen to indicate which direction you want the ball to be shot at. On release the ball should move into that direction and hopefully gets into the target and if not gravity and friction causes it to come to a stop.

The problem is how do I code something like this?

2) I need the ball to rebound of the walls and I will have some blocks angled so that the ball has to hit a certain part to get to the target. The ball will eventually come to a stop if the target is not reached.

How can I make a method to create the collisions of the wall and blocks?

I have spent the last weeks trying to find tutorials to help me make the game but have not found much specififc to the type of game i making. It would be great if sample code or template could be provided as this is my first android app and it is for my final year project and i do not have much time left.

Thank you in advance
akkki
 
basically its the same shooting mechanism as stupid zombies which is a popular game on google play. there is a ball on the screen. say on the left bottom. when you touch the screen crosshairs appear which you can move to the direction you want. As soon as you release your finger from the touch screen the ball moves in the direction of the cross hair.

hoped that helped to make it a bit easier to understand how the shooting mechanism works.
Thank you
 
Can you provide a screenshot? I shouldn't need to go download an app and play it against my will just to answer your question.

Regardless, I suggest breaking your project down into smaller parts and starting there. Once you figure out how to do each mechanic or sub mechanic, you can tie them all together on a larger scale
 
Can you provide a screenshot? I shouldn't need to go download an app and play it against my will just to answer your question.

Regardless, I suggest breaking your project down into smaller parts and starting there. Once you figure out how to do each mechanic or sub mechanic, you can tie them all together on a larger scale

im sorry i didn't mean it like that , i just thought it was a popular game so most people knew about it like angry birds. i have attached a screenshot. See how the gun on the guy faces the crosshair because when he shoots the bullet will go in that direction.

I am breaking my project and doing it in parts. I have done all the menu sound etc just the game functions im finding difficult. Thats why i need help with the shooting and collision detection.
 

Attachments

  • stupid-zombies-35.png
    stupid-zombies-35.png
    294.3 KB · Views: 69
Oh, well that's not really "into the screen". At any rate, since your game seems to have some need of physics, I recommend looking a JBox2D. Its a free, open source 2D physics library. It's actually what angry birds uses. With that, you should easily be able to fire the ball towards a specific target.
 
Back
Top Bottom