Advertisement

panzer blitz

Started by January 09, 2025 12:06 AM
1 comment, last by pbivens67 3 days, 5 hours ago

I am working on a panzer blitz game. Here is my map and some tokens. I just want to know how to move the tokens with the mouse.

I have got the sprite to drawn to the right of the original sprite, I want the sprite to be moved by clicking and dragging the sprite

					else if (event.type == SDL_MOUSEBUTTONDOWN||SDL_MOUSEMOTION) {
						if (event.button.button == SDL_BUTTON_LEFT) {
							int mouseX, mouseY;
							SDL_GetMouseState(&mouseX, &mouseY);
							cout << mouseX << " " << mouseY << endl;
							if (mouseX > 522 && mouseX < 567 && mouseY>394 && mouseY < 439)
							{
								SDL_Rect rect_two;
								rect_two.x = 567;
								rect_two.y = 394;
								SDL_BlitSurface(gHelloWorld_one, NULL, gScreenSurface, &rect_two);
								SDL_UpdateWindowSurface((gWindow));
							}
						}
Advertisement