Guest _ginger_ Posted October 15, 2004 Report Posted October 15, 2004 Hi all, i wrote past week with a problem with the rotate of bitmaps(posted by my old nick requiem) Like i said, im writting a 2d car game. Ok, the problem now is that a i have no idea how to know when the car is out of the road. The thing i want to do is when the car is out of the road decresse the speed of the car. First i thought to get the pixel color of the out-road. And if the car is on that color pixel drecreese. But it have a problem. The out-road of the circuit have many colors , many many colors so is impossible to be cheking if the car is on one of them. And, if you make a new circuit with differents colors, you have to change source code :x So, one of you hace any suggestion? I dont have any idea how to do this. I hope someone clever than me could help me. Thanks all of you. This forum is awesome, you are resolving a lot of problems i have
Guest muff Posted October 15, 2004 Report Posted October 15, 2004 more giving away of secrets now ^_^ what games typically have is tiles for the screen and associated tiles for masking, or in this case, grip which means that you make a second set of tiles that match the first, but they contain a colour to represent the 'grip component' of that tile/pixel when you draw the tile for the screen, you also draw the file for the grip to a separate memory buffer, and it is this buffer you check the pixel colour of when you want to calculate the grip the car has happy coding muff
Guest _ginger_ Posted October 17, 2004 Report Posted October 17, 2004 thakns muffy for your always quicklys answers. Now i take some time to reply because now i don have internet conection and i have to reply from a friend's house. Ok, i understood the thing of the second circuit with colout to represent the different situations. I have made it. But i can't use the function GetPixel(hdc,posx,posy) because i use a library to work with images, and i dont know how to use the type of var "hdc"" handle device context". Could you post some code to load the image(from a resource) in buffer where i could get the 'hdc'?? I have been trying to get it ,but no idea. Thank you very much.
Guest muff Posted October 17, 2004 Report Posted October 17, 2004 I'm guessing that you are using BitBlt to blit the graphics of the track to the screen, in which case you have a target window (using a window handle) from which you can get an HDC GetDC(window_handle); of course if you are using another gfx library, then within that you can use it's internal pixel query function (assuming it has one) which is likely to just use a pointer to the 'surface' all in all it's a topic that is very dependant on the code you are currently using, as there are lots of methods for doing this kinda stuff personally I've written my own gfx library, with my own functions - everything is then under my control - kinda ^_^ lots of this stuff is out there on the web, especially if you are using windows internal blitting stuff - just do a search for Win CE examples rather than Smartphone ones (which are very rare atm) and you should find some http://www.pocketpcdn.com is a good place to start maybe in the future I should sit down and write a book on this stuff :D happy coding muff
Guest _ginger_ Posted October 19, 2004 Report Posted October 19, 2004 Thanks. Now the game run very good with colissions. The car now run and collide with the walls that i paint with green. The problem is that i dont know how to make a new device context with the circuit that is painted, but has not to be show. I think the solution is to put it in a buffer or like. Now i am looking the color of the mainwindow device context. Another problem i have is that if i play a bit with the game, when i exit the game, the image get freezze, but not the smartphone because i can push the menu buttons, but seeing nothing. Also, i can go to the main menu of the phone (with the house button) but the las image of the game still there. If i play 10 or 15 seconds, i can exit the game perfectly. No idea. Thank you
Guest _ginger_ Posted October 19, 2004 Report Posted October 19, 2004 Oh, i forgot. If i have time, the nex time i will post the game, if you like to see it. Bye
Guest muff Posted October 19, 2004 Report Posted October 19, 2004 Thanks. Now the game run very good with colissions. The car now run and collide with the walls that i paint with green. The problem is that i dont know how to make a new device context with the circuit that is painted, but has not to be show. I think the solution is to put it in a buffer or like. Now i am looking the color of the mainwindow device context. Another problem i have is that if i play a bit with the game, when i exit the game, the image get freezze, but not the smartphone because i can push the menu buttons, but seeing nothing. Also, i can go to the main menu of the phone (with the house button) but the las image of the game still there. If i play 10 or 15 seconds, i can exit the game perfectly. No idea. Thank you it sounds to me like you are still using the built in window blit functions which are never a good idea for games and as for the collision buffers they should always be just buffer areas of memory - but that means stepping away from BitBlt type functions ^_^
Guest _ginger_ Posted October 20, 2004 Report Posted October 20, 2004 Yes, i am still using default functions. Some days ago i download a GAPI library from www.pocketpcdn.com but it give me some errors when i compile. So i thought it is for PocketPC and will not run under smartphone 2002. Could you say me a good graphics library to resolve me the lot of problems i have?? Thank you muff, you are the best ^_^
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now