Racing games (I) Implement interaction between two mobile phones through Bluetooth

Source: Internet
Author: User

Original address link

 

This example is associated with the example of "racing game (ii)" and enables human-computer interaction through Bluetooth.

 

Download source code

 

To run this app, you need two bluetooth terminal phones (for example, Sony Ericsson k750) and connect them before starting the app. Once communication is established, the 3D world will start and each player will see two racing cars: himself and his opponent. In the 3D world, each player can use a cell phone soft key to manipulate his own racing car.

Bluetooth is a part of the application and consists of servers or clients. Players choose one of them.

When you move your car, the latest position and rotation coordinate data will be sent to other players, so your position can be correctly displayed on the opponent's screen.

Players can control the movement of cars, but this is limited. When a contestant moves the racing car, the camera will move in the same way. The racing car can move like this:

L arrows rotate left/right: left/right

L up/down the Arrow: Move the front/back

L key 4/6: Move left/right

L fire key: camera follows racing car

In commercial applications, using hardware to connect URLs to other mobile phones may lead to faster Bluetooth connections. Once connected, you can obtain the URL, so it will be faster when connected again.

Source: http://www.j2medev.com/Article/ShowArticle.asp? ArticleID = 1104 Author: numenzq

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.