I'm currenty creating a project that allow user to drag the ball and flick the ball towards
the goal (football penalty kick/basketball shooting game).I've been searching on how
to flick the ball that will create a trajectory or even thrown into direction which
intended by the user.
I modified the project uploaded in below path but there is no success.I was able to stop the constant moving of the robot, which dragging of the image in any parts of the screen was left but I was not able to create another changes.
http://obviam.net/index.php/moving-images-on-the-screen-with-androi/
I'm needing an example similar to kicking the ball or flicking the ball or tossing the paper game.
Thank you.
Related
I want to implement a gaming scenario where a ball keeps moving continuously, hitting and bouncing off the wall.
How can I implement this, taking into account that path should be random?
I tried ObjectAnimator, but which always require an x or y coordinates specified.
Any idea?
I need to create a simple game in which one object moves on the screen based on touch (mouse) events. In other words I want to be able to drag it on an Android machine's screen.
Looking everywhere there are many great examples of "ball" type games in which a ball is bouncing on the screen, responding to gravity and even colliding with other objects, static or dynamic. But nothing that actually has an object that I can touch and move on the screen.
Can anyone point me in the right direction?
I am trying to learn some more about gestures and graphics in Android, so I am trying to make a sort of game where you start with a ball (just a red circle) in the middle of the screen, and if you swipe in a direction, the ball will be launched in that direction, bouncing of the screen etc. Now, I have succeeded in detecting when somebody swipes in a certain direction, and currently I just display the direction on the screen. My question is: how do I continue? How can I draw the ball, make the user able to move it and make it bounce off the sides of the screen? I think I need to use onDraw somehow, but I'm not sure.
There's a guy with similar problem, he has managed to get circles going around the screen and bouncing from the edges, you may use his code as a basis for your drawing and animation routines: Moving circles in android
Im making an Android game and I'm looking for a relatively simple tutorial on ball collision detection. In particular an elastic collision between 2 balls (That is to say how balls would behave after the collision - kinda like pool balls when they collide).
Also, if anyone knows of an example/ tutorial on deceleration and acceleration I would appreciate it. I'm detecting if 2 balls are in proximity (not colliding yet) with each other. If ball 1 is within a certain radius of a static ball 2, ball 1 will start to decelerate. Once ball 1 reaches another point closer to ball 2, ball 1 will change direction and start accelerating again to its original velocity.
I can detect the first collision and decelerate ball 1, as well as switch its direction, but the acceleration I implemented is not correct.
If someone maybe knows of such an example, can you maybe point me in the right direction?
http://www.euclideanspace.com/physics/dynamics/collision/twod/index.htm
http://www.gamasutra.com/view/feature/3015/pool_hall_lessons_fast_accurate_.php
i am trying to do this:
1) user long touches the screen,
2) a circle/ball pops up (centered around the user's finger) and grows in size as long as the user is touching the screen
3) once the user lets go of the finger, the ball (now in its final size) will bounce around.
i think i have the bouncing around figure out from the DivideAndConquer example, but i am not sure how to animate the ball's growth. i looked at various view flipper examples such as this:
http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html
but it seems like view flipper is best for swapping two static pictures. i wasn't able to find a good view animator example other than the flippers. also, i would prefer to use images as opposed to just a circle. can someone point me in the right direction?
thanks.
Here are two simple tutorials to help you get started with drawing basic animations including touch input: balls bouncing randomly around the screen and basic drag and drop.
In brief: You're right, ViewFlipper is really not suited for this. You want to draw on a Canvas by making your own custom View. This is the basic framework for 2D graphics. Canvases let you draw image files, solid colors and other things to the screen, while applying transformations ot them at the same time. Handling the user input (i.e. the finger on the screen) is done via the onTouchEvent(...) method, which lets you do something when the finger touches the screen, moves on the screen or lifts off. Have a play with those two tutorials, they should give you the basics.
If you're using a bitmap on a canvas to draw it
http://developer.android.com/reference/android/graphics/Canvas.html#drawBitmap(android.graphics.Bitmap, android.graphics.Matrix, android.graphics.Paint)
Use a scale matrix, the identity multiplied by the scalar of the size you want the image to be.