Change TMX map dynamically - android

I'm trying to develop pacman for Android. I am using andengine with tmx map but I'm having a bit of difficulty in managing the collection of balls ..
I initially tried to create an object for each ball, but 240 objects have halved my FPS.
Then I tried to insert the ball directly into tmx map and then later change the tile with the ball, with tile empty ..
how can I dynamically change the tile?
on TMXTiledMapExample there's:
`189: // tmxTile.setTextureRegion(null);` <-- Rubber-style removing of tiles =D but it doesn't work D:
Can you help me to find the best way?
ps: sorry for my bad english :)
pps: GLES2

Andengine doesnt allow null tiles at least to my knowledge setting a tile to null will most likely give u a null pointer u can try filling it with a clear color or something that matches the background

Related

Rendering a frame around a 3d object using opengl

I am rendering a 3d Object using Rajawali and Opengl on android. I want to render a cube around boundaries of the object in exactly the same as shown.
I understand the I may need to use a set of lines or the stack api in rajawali. But I dont understand how can I use the Object3D api to figure out which points consists of the line. I tried using Object3D.getGeometry().getBoundingBox() api but its returning null.
I need hints on how can I derive the min max Number3d points using Rajawali api and whether it would be the right solution to create a set of 12 lines based on those lines. Or should I somehow augment it into the Model after loading so that i can scale around with it?
This may be too obvious but please consider me a beginner. Thanks.
Object3D.getGeometry().getBoundingBox() return undefined value until you call Object3D.getGeometry().computeBoundingBox() method which updates the bounding box information.
The Answer below will give you more information if you are using complex 3d objects with scene hierarchy.
Any way to get a bounding box from a three.js Object3D?
Update:
The best way is to create a separate object with lines using Min/Max values and use the original object's Transformation. Or make the BoundingBox geometry a child for the original object.

Motion to draw numbers on android

im new to this android things. And i have to develop an application that can help an autism to learn numbers. I have a few ideas and I've been trying to learn and implement the code. But it's failed. The question is how can i apply the motion code or sprite to draw a numbers or letter? For example like this, i wanna make the penguin move through the line and draw a number nine.
There is example from mybringback.com which is the image move to draw a rectangle. How can i implement it to draw a number? Im sorry if i asking too much, i just trying to get some ideas.
I think that you should first build an utility program, in order to create the "path vector".
What I mean by path vector is simply a vector of Points (where a point has x value, and y value). And your utility should let you draw whatever you want, with a simple pen. You should draw on surface and store points when mouse is down, and ignore points when mouse is up.
Then, in the main program, you will just have to read at the path of your number/letter.
I've tried to implement something like this for the Sugar OLPC platform, without serializing path into files : I was able to draw, and to view the animation. And I used the process I've just described you.
Hope it can help you.
P.S : I used the word mouse, but you guessed that I talk about finger ...
There are various ways to achieve animation effects. One approach that is quite versatile involves creating a custom View or SurfaceView in which you Override the onDraw method. Various tutorials can be found on this; the official Android discussion of it is here:
http://developer.android.com/guide/topics/graphics/2d-graphics.html#on-view
Your implementation will look something like this:
// Find elapsed time since previous draw
// Compute new position of drawable/bitmap along figure
// Draw bitmap in appropriate location
// Add line to buffer containing segments of curve drawn so far
// Render all segments in curve buffer
// Take some action to call for the rendering of the next frame (this may be done in another thread)
Obviously a simplification. For a very simplistic tutorial, see here:
http://www.techrepublic.com/blog/software-engineer/bouncing-a-ball-on-androids-canvas/1733/
Note that different implementations of this technique will require different levels of involvement by you; for example, if you use a SurfaceView, you are in charge of calling the onDraw method, whereas subclassing the normal View lets you leave Android in charge of redrawing (at the expense of limiting your ability to draw on a different thread). In this respect, Google remains your friend =]

Display and scroll over big layout

would be very grateful if anyone can advice how to solve the problem.
I got to draw a large and rather complicated structure (railway track layout). In order to have a smooth scrolling I wanted to draw the layout into a bitmap and then just to copy necessary part into the screen canvas in onDraw method.
The problem is that the layout is much larger than 2048x2048 (max allowed texture size on my Asus Prime) and I'm getting 'Bitmap too large to be uploaded into a texture'.
And this's even without zoom.
The layout is just a set of 2d geometrical primitives so maybe it's possible to work on geometrical rather than bitmap level, but how to implement smooth scroll and zoom then ?
What are common ways of solving this issue ?
Thanks in advance.
You should use a tiled approach. Divide your large map within small ones and render them while you move. Like google maps does.
You could use the TMX format: http://www.mapeditor.org/
AndEngine http://www.andengine.org/ has an implementation for it.

How to place object in specicifc place with tiled and AndEngine?

I am using AndEngine to create a Test run project.
I am doing well so far. The only problem i run into is when using Tiled map editor and i load the tmx. file into the project. The map is loaded correctly, but i am having trouble understanding how the whole tile piece works. How would you go about positioning a Charactor or a object on a specific area of the map like if you have a grown how do you set place the object on the top of the ground for a side scroller type game?
And also is there collision detection so if the character is on the ground then it does something?
Thanks for all the help!
read this example my friend, it will help you
Andengine tutorial and example

can we display a mapView like google earth(see screens)

ok to clarify. i understand that the map data is basically some images grouped in bounding boxes and drawn on a 2d canvas. is it possible to rotate the whole view so that it looks like on the image i posted from google earth, to get a kind of fly-over look? i know that there is a class in adroid used for 3d rotations on images(the camera class Graphics.camera)
There was a nice tutorial not long ago from sony-erricson with their 3d listview describing its functionality, but i don't think i can achieve what i need with it. is there a way that a view can be rendered maybe on a GL surface?
i realize that this isn't that simple to do but any suggestions or ideas on the matter can be helpful.
so where do i start?
tnx.
Very straightforward with OpenGL. Use triangles laid out in a huge grid and texture map accordingly, setup a camera and you are done. You even get elevations etc right with heightmapped terrain.

Categories

Resources