Skip to main content
gamedev.net
🔒 Locked

IPhone Touch Screen

Started by anupgupta 0 replies 1.2k views
Original Post
anupgupta
anupgupta
Hello Everyone

I am kind of new to iphone and currently working on a 2D project using OpenGL...
I have a few queries which i would like to get, some advice on it..

Well, currently the game is like traffic management, and screen is in landscape mode...now, i a have cars which can come from top, bottom, left or right...when the player touches any car and swipes across the screen the car velocity increases in that direction and the car goes out of the screen..which means he successfully passed the car through the traffic..and thus, the cars keep on coming through other directions and he has to manage them...without colliding with the other vehicle..

Now the query is that...
1. As iphone is all touch, how would i determine in which direction the player has swiped..i.e top-bottom, bottom-top, left-right or right-left. (any advice on this would be of great help or any other idea on how this could be handled)

2. As initially the game starts the cars come in few numbers..but as the game progresses the number of vehicles coming on the screen increases gradually..
I would like to know as to how could i implement this behavior as this also increases the difficulty accordingly..
(one of the options i have in mind is to keep a timer and increase the number of car as time progresses..is this feasible)

WOsborn
WOsborn
Check this out... Traffic Rush by Donut Games
http://itunes.apple.com/app/traffic-rush/id322423174?mt=8


As for your question about knowing which direction.

On touch DOWN: record 2d location of touch
On touch UP: record 2d location of release

vec2d screen_direction = normalize(vec2d(UP.x, UP.y) - vec2d(DOWN.x, DOWN.y));

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.