Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a getDistanceToObject(objectIdentifier) type function? #10

Open
mxdubois opened this issue Dec 4, 2012 · 3 comments
Open

Is there a getDistanceToObject(objectIdentifier) type function? #10

mxdubois opened this issue Dec 4, 2012 · 3 comments
Assignees

Comments

@mxdubois
Copy link
Member

mxdubois commented Dec 4, 2012

For example: getDistanceToObject("player")

This isn't super urgent, but we'll need it at some point.

@ghost ghost assigned ejamroz Dec 4, 2012
@ejamroz
Copy link
Contributor

ejamroz commented Dec 4, 2012

Yes there is. I have written it in the feature/dualTarget branch under mobile. It is currently written in c++ in the SampleMath.cpp file. My current idea would be to do the calculation in the c++ and then set a flag in the JSON object if the phone was to close and pass it up to the java. How do you feel about that approach?

@mxdubois
Copy link
Member Author

mxdubois commented Dec 4, 2012

Well, the calculation should definitely happen in c++, but so far we've kept all the JSON work in Java. Also, since everybody in class feels the distance limitation should be implemented on the phone,it doesn't necessarily have to go in the JSON. We could put it in there for kicks though, in case anyone wants it.

It makes the most sense to me to call a JNI from java the same way we get the phone location. That way we can keep the gameplay/UX logic at a higher level and stick to rendering and calculations in c++. Does that sound right? So all you would have to do is return the unit distance from the phone to the player (or to any object if you have that kind of time on your hands).

@mxdubois
Copy link
Member Author

mxdubois commented Dec 4, 2012

If it's simpler, it could also take the form of getDistanceToPosition( x, y, z) so that we have to pluck the position out of the JSON in onGameStateChange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants