Win a copy of Spring Boot in Practice this week in the Spring forum!

manish ghildiyal

Ranch Hand
+ Follow
since Jan 12, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
12
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by manish ghildiyal


...and am facing it with every browser.
8 years ago
Hi,

For last almost 2 months I am witnessing that it takes eternity for this site to load and finally session expires.
Am I the only one facing it or others also having similar issue?

Is it location based?I am from India.

Manish
8 years ago
Hi,

I am working on a game based exactly on same architecture as used in SuperJumper game of book 'Beginning Android Games'.
I want to have swipe functionality. So I have implemented OnGestureListener.
So I have put the OnGestureListener instance in AndroidInput just like we have for TouchHandler.
But onFling() is not getting called.


Where am I going wrong?
Please advise.

I have also posted same query on forum for Badlogic games(http://badlogicgames.com/forum/viewtopic.php?f=21&t=11603).

Manish
8 years ago
Hi Karthik,

Thanks for inputs.

So, when I have accelerometer values with me then how can tilt data be extracted from it? Do I need to use
trigonometry for it or is it much more involved?

Manish
8 years ago
....sorry to forget to mention that I am working on Android.
8 years ago
Hi,

I am trying to develop a simple game where players just tap a ball around.
So 4 players are positioned on a circle at gap of 90 degree each. What I want
to have is that for passing the ball from one player to another player user needs to tilt the device
in appropriate direction.
So my plan is to somehow determine the direction of tilt so that I can determine to which player
the ball would move next.
I have gone through articles and forum posts, and understand that to determine tilt direction
I need to make use of rotation matrix.
But I am not able to really understand how to go through it all. Android documentation seems to be sparse.
Can someone give me some direction on this?

Manish
8 years ago
b[i] = (Point[]) a[i].clone();
This line of code is shallow copying as calling clone on an array just copies the references in cells.


for(int j=0;j<b.lenght;j++)
b[i][j] = (Point)b[i][j].clone();

Here it seems you are trying to do deep copying but I guess you need to implement
clone method for Point class accordingly.

Manish


8 years ago

Campbell Ritchie wrote:It showed 13 15 x = 6 for me.



...me too
8 years ago
If I understand correctly you want to see the values array cells have at specific points in your code.
If that is the case, then just write a small piece of code which iterates through your array and prints
its cell values.As yours is an 'array of arrays' so you need to run two loops, one inside other. And
keep the code inside a method and call that method wherever you want to check the current values in array.
Hope it helps you.

Manish
8 years ago

Campbell Ritchie wrote:Welcome to the Ranch

There ain't no such thing as a 2D array in Java™



My bad. I stand corrected.

Manish
8 years ago
Sorry but couldn't get what actually you want to acheive?

Manish
8 years ago
Store the data you read in some form of data structure.As you have limited data,
you can use arrays and for your case 2 dimensional array(3x7) would suit the needs.
Now once you have the data in your hand, use it in specific methods.
For example to list the total number of calories consumed each day I would write
method like 'printTotalCaloriesConsumedEachDay' wherein I would just iterate
through array and sum up values in all three cells for each row and print it.


Manish
8 years ago
You just need to write your logic of comparing two Gamedetails in compare method of Comparator.How you write it
is entirely your dicretion(Just make sure that you follow certain guidelines while implementing compare method which you can easily find in net).
Then just pass the array and your comparator instance to sort method. Sort would do all the stuff by itself.

Manish
8 years ago
You want Arrays.sort to sort your data, but what should be the basis of that sorting?
Data you want to be sorted is defined by you and hence you also need to define the criteria for its
sorting which you do either by implementing Comparable interface for your data class(Gamedetail here) OR
by writing a class which implements Comparator interface and then use another version of sort() which
takes 2 arguments...data to be sorted and your version of Comparator implementation.
8 years ago