Computer Science, asked by diwesa1091, 7 months ago

car = pygame.image.load('sprite.png')
win.blit(pygame.transform.scale(car, (450, 450)), (70, 250))
pygame.mouse.set_pos([295, 480])
carpos = pygame.mouse.get_pos()
x = carpos[0]
win.blit(car, [x, 480])

I first made a car variable and added the png. I edited its size and starting positions. But i wrote the code below it to make it move with mouse but only in X Axis. But its not working. Can u help me finding the mistake pls?

Pygame
Pls help me! Its really important ​

Answers

Answered by harnathyadav2907
1

import pygame

pygame.init()

win = pygame.display.set_mode((500,500))

pygame.display.set_caption("Altoria")

mc_front = pygame.image.load('bernie front.jpg')

mc_front = pygame.transform.scale(mc_front, (100, 160))

block = pygame.image.load('block.png')

block = pygame.transform.scale(block,(100,60))

block_x = 100

block_y = 50

x = 50

y = 400

width = 40

height = 60

vel = 20

I hope it will helps you ❤❤❤❤

Similar questions