How to go about creating a race track game? [close

2020-02-29 03:11发布

i am planning to make racing game in android.I have created many applications in different mobile technology. but i am pretty much beginner for game application. So my question is how can i make race track in android? How should i show that car is moving on that race track. I have the images of cars and race track. But i have no idea how should i show the part of race track and how should show that car is moving on that track??

2条回答
可以哭但决不认输i
2楼-- · 2020-02-29 03:30

I suggest you download AndEngine ( an open source 2d android game develoopmnent framework ). In the examples there is a (very simple) race track demo with a movable car + controls + obstacles. If you have troubles you can always get support from the forums

AndEngine has a very easy learning curve :-)
Have fun creating your racing game!!

Here are 2 good tutorials on starting with 2d:
- Canvas tutorial
- OpenGL tutorial

The last part, about showing only a part of the map, can be achieved by using a BoundCamera in AndEngine.

查看更多
劳资没心,怎么记你
3楼-- · 2020-02-29 03:50

You should start with studying the 2D graphics capabilities of the Android library. Here's another good reference article. It lists some drawing options including drawing to the Canvas object which is probably the right choice for the kind of game you're describing.

Here's a full but simple example of handling the onDraw event for a canvas and performing custom drawing. Here's a small bit of the code:

        paint.setColor(Color.BLUE);
        canvas.drawCircle(20, 20, 15, paint);

The above is a simple example that draws a circle with a particular size to a particular location on the canvas. It's a good place to start. To finish your game you'll be drawing bitmaps which is a more complex process but conceptually similar.

查看更多
登录 后发表回答