###問題
PygameでPython3を使ってゲームを作っているのですが、以下のコードを実行するとエラーが起こります。
エラーの種類は、
unexpected token '<new line>' 17行
unexpected token '<dedent>' 17行
unexpected end of file 19行
です。
基本的な構文の間違いだと思うのですがどこが違うか理解できません。
ご教授いただけると幸いです。
###ソースコード
Python3
1import pygame 2from pygame import * 3import sys 4 5class Button(pygame.sprite.Sprite): 6 def __init__(self, normal, above, onclick, rect): 7 #なにもない、重なってるとき、クリックしてあるとき、場所 8 self.normal = pygame.transform.scale(normal, rect.size) 9 self.above = pygame.transform.scale(above, rect.size) 10 self.onclick = pygame.transform.scale(onclick, rect.size) 11 self.rect = rect 12 self.image = self.normal 13 14 def update(self, cur_pos): 15 mouse_pressed = pygame.mouse.get_pressed() 16 if self.image.Rect.collidepoint(cur_pos): 17 if mouse_pressed[0]: 18 self.image = self.onclick 19 else: 20 self.image = self.above 21 else: 22 self.image = self.normal 23 24 def contain(self, cur_pos): 25 if self.image.Rect.collidepoint(cur_pos): 26 return True 27 else: 28 return False
###使用環境
Visual Studio 2017