Guest r3k13m Posted October 10, 2004 Report Posted October 10, 2004 Hi. Im newbie programing for smartphone, but i have some experience programing for other platforms. Im triying to do a small 2-D car game. I have the bitmap of the car, but i have no idea how to rotate de bitmap when the car turn to any angle. So the question is: How to rotate a bitmap to any angle?? :shock: Thanks and sorry for my english, :oops: im spanish.
Guest muff Posted October 10, 2004 Report Posted October 10, 2004 firstly - welcome to the site second - if I were you, intead of a rotated blit, I'd create all the rotated versions of the car into the original file, and just blit the one you want - it's FAR faster
Guest r3k13m Posted October 10, 2004 Report Posted October 10, 2004 I thought to do this, but the problem is that if i take that solution i have to do a lot of images of the car and i dont know if the result would be good. Also i want to make various number of diferent cars, and the work will be multiplicated. But, provisionaly i co uld take this solution. Can you explain a little bit how to change quickly the different sprites of the car? Or to do this i have to load all bitmaps and be changing all of them in the source code depending the movements? Thanks a lot for your early answer ^_^
Guest muff Posted October 10, 2004 Report Posted October 10, 2004 well this is really a complex question at the end of the day, there are lots of things to consider to begin with, for games I wouldn't use the windows blitting stuff in the first place, I'd use the GAPI interface to write to the screen more directly - this is a little more complicated however as it doesn't have any built in blit functions but either way I'd put all the rotations in a single wide image (so it looks like a film strip - see below) and blit the 'frame' of that onto the game area that I needed if speed is not so much of an issue. then you can do the rotation in code, but this is fairly complex in itself - do a search on the web and you can find code for doing the rotations - you then just adapt it to run on the smartphoneImage1.gif
Guest r3k13m Posted October 11, 2004 Report Posted October 11, 2004 Ok, at the moment i am using this way. I have made some diferents positions of the car and take the position i need in the moment i need. BUT now i have another problem. I have a circuit to race. How i can know when the car is out of the zone? i mean, i want to know when the car , for example, is on the grass to reduce the speed of the car. Im breaking my brain, but i have not idea to do this. I thought to take the color of the pixel that is under the car, and if this color is the grass, for example, reduce the speed, but i dont find this function, the function to know the color of a x y position of the background. Any Help?? Thanks very much
Guest beersoft Posted October 11, 2004 Report Posted October 11, 2004 i would have a matrix of track, grass and walls something like this #= track @=grass *=wall ********** *@####@* *##@@##* *#@**@##* *###@#@* *@@##@@* in an array so you can lookup where the car is and decide what its doing in releation to the track this also works nicely if your using a tilemap for the track later Owen
Guest r3k13m Posted October 12, 2004 Report Posted October 12, 2004 The problem of this solution is that, if the circuit i big, is very hard to do an array with the information of all c-y coordenates. And also the array would be very big. Think that the circuit is 7 or 8 times more big than the display of the smartphone. Do the array is very hard work. Thin if i want to do a new circuit , i have to make a new array and a new program!!!! Is good idea for small circuit, and if you will not make new circuits after finish the game. Thanks very much. Any other suggestion??
Guest muff Posted October 12, 2004 Report Posted October 12, 2004 what you are going to find is that the basic draw functions are not really setup for gaming, you are going to have to look further afar or else write your own functions http://www.pocketpcdn.com/ is a good place to start but if you really want to stick with the built in stuff of evc then GetPixel( HDC hdc, int nXPos, int nYPos ); is what you want p.s. it should really look at the pixel beneath all 4 tyres, and adjust handling appropriately
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now