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

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

Related

does libGDX box2dDebugRenderer renders ray?

I am using libGDX for hobby Game Development,I am using two stages one is for graphics and one is for box2d world with debugDraw, every box2d fixtures debugDraw well with their graphics but I cant debugDraw a raycast!, how can I easily achieve that?
THANK YOU.
DebugDraw does not render RayCasts as they are not an object in the box2d world. It is more like a query and does not persist.
But you could use your starting vector and the the point of the RayCastCallback that is going stop the raycast to draw a line via DebugRenderer.line(a, b). Of course, if you want this line to show up more than one frame you have to store your vectors somewhere.

Change TMX map dynamically

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

[Android]min3d -collision detection and some stuff

I,m using min3d framework on my device to make some car game, so i created some simple car model and simple and its moving, but i want to create ''physics'' and i need the collision detection which isn't provided in min3d (i won't change framework because i have android 2.1 without possibility to upgrade) i want to create it by my self but the problem is that i don,t know how to check if the plane collides with anything what i want to do is:
-create simple flat rectangle (not cube) and i want to place it in front of ''car'' and check if something gets inside of this rectangle and something does i want the car to bounce of it in reversed direction (the problem isn't to bounce but: how to check if something gets through my rectangle)
I have some other problem too:/
When i enclose my ''game''(haha) with a LinearLayout in xml everythong is going fine till i use the command to set the text with the value of rotation of a car for example -then is force close:/ I'm doing it form my class from which i load my objects (i'm providing my classes too)
I was searching for tutorials on the web but none of them was tlaking about 3d collision and even if it was about 3d there was too much code that wasnt need and i was loast in it so i dont get anything
I ask you royal users from stackoverflow to provide me example for creating the rectangle(if needed, because i can laod model from .3ds and .obj)and check if something gets through it(intersects?) not for entire code but just for the method how to do that, and how to refrsh the value of a car, in layout without a crash
By the way: my ''game'' is using qwerty keyboard as input (i,o,p,l keys)
Wanted to post my class here but its to much of lines and was getting erros so grab it on free hosting site, its scanned by avast already on my pc, it contains my entire project with min3d too.
My sources ready to compile and run are(with min3d -which isn't mine):
http://odsiebie.pl/ax1v1p5tam8i/KRL044.7z.html
thanks in advice:)
an approach is to break it down to two dimensions (xy). imagine that your cars are 2D-Rectangles. in the moment you want to check collision, just check if any of the four corners of your "car" is within the rectangle of another car. might be not best practise but works for me.
instead of this you could use r-tree sqlite to check collision.

animation with sprite 2D android

I am building a virtual store with the effect same like this
enter link description here
The user can freely rotate the image from left to right and top to bottom or vice versa. I suppose to use sprite 2D to implement that animation. There are some tutorials I found but because Im pretty new about graphic programming so could anyone point me to the correct way that approach my expected performance. Thanks a lot.
The easiest way is to use the Canvas API in Android. Here is an example of how to use it with sprites.

How to buil a clickable custom map using path and region in Android

To explain my problem, I am going to start from a case study that is not what I have to do but which will give you a good idea of what I am talking about.
Imagine the map of the US in which you have the states / provinces. Each of these provinces has got a shape that is random (by random I mean it is not a rectangle, a triangle or a circle). I need to build these shapes independantly, size them correctly and put them at the correct place on the screen to represent the country. Finally, each of these province should be clickable.
To achieve that :
1) I don't want to use google map
2) I guess that I'll have to construct each provine using android path and android region ... can you confirm?
3) Is there a graphical tool for building these paths (photoshop import ?)
4) Assuming that I succeed to build the path, how can I put them at the correct place on the screen ?
5) How can I make these path clickable ?
Basically, I want to build an interactive map with clickable items that doesn't use Google map because it won't necessarly be a real map.
Thanks for your help,
R.
There are lot of variables in the problem you describe:
If you don't want to use google-maps, you'll need to use another engine. There are a few open-source ones available.
If you feel you don't need a map engine, you'll need to provide you're own image of the US to draw on an pin the image to the View
How do you plan to draw the boundaries? Do you have coordinate data for the boundaries or do you plan to draw them manually.
I would suggest first looking at openstreetmap: http://www.openstreetmap.org/ The have a lot of information and tools on creating Maps. From there you can attack adding to the phone. Or you can use their web api and build a web view for doing what you suggest.

Categories

Resources