質問編集履歴
3
こーど修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,10 +23,10 @@
|
|
23
23
|
pygame.init()
|
24
24
|
screen = pygame.display.set_mode((1280, 720),FULLSCREEN)
|
25
25
|
pygame.display.set_caption("パイソン pygameで画像表示する")
|
26
|
-
image = pygame.image.load("
|
26
|
+
image = pygame.image.load("x.jpg")
|
27
27
|
clock=pygame.time.Clock()
|
28
28
|
vx=vy=1
|
29
|
-
imageCosmos = pygame.image.load("
|
29
|
+
imageCosmos = pygame.image.load("x.png")
|
30
30
|
y = 720
|
31
31
|
while True:
|
32
32
|
clock.tick(60)
|
2
コード修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,19 +18,16 @@
|
|
18
18
|
import sys
|
19
19
|
from pygame.locals import *
|
20
20
|
|
21
|
-
pygame.init()
|
22
|
-
screen = pygame.display.set_mode((1280, 720),FULLSCREEN)
|
23
|
-
pygame.display.set_caption("パイソン pygameで画像表示する")
|
24
|
-
image = pygame.image.load("z.jpg")
|
25
|
-
|
26
|
-
vx=vy=10
|
27
|
-
imageCosmos = pygame.image.load("x.png")
|
28
|
-
clock=pygame.time.Clock()
|
29
|
-
y = 720
|
30
|
-
|
31
|
-
|
32
21
|
|
33
22
|
def main():
|
23
|
+
pygame.init()
|
24
|
+
screen = pygame.display.set_mode((1280, 720),FULLSCREEN)
|
25
|
+
pygame.display.set_caption("パイソン pygameで画像表示する")
|
26
|
+
image = pygame.image.load("tdu2.jpg")
|
27
|
+
clock=pygame.time.Clock()
|
28
|
+
vx=vy=1
|
29
|
+
imageCosmos = pygame.image.load("cosmo.png")
|
30
|
+
y = 720
|
34
31
|
while True:
|
35
32
|
clock.tick(60)
|
36
33
|
y = 720
|
1
コードを追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,47 @@
|
|
12
12
|
|
13
13
|
pygameを利用して直線方向に一回移動できるプログラムはサイトを参考に作りました。
|
14
14
|
しかし、指定座標への移動、その次の座標への移動方法がわかりません。
|
15
|
+
###
|
16
|
+
```python
|
17
|
+
import pygame
|
18
|
+
import sys
|
19
|
+
from pygame.locals import *
|
15
20
|
|
21
|
+
pygame.init()
|
22
|
+
screen = pygame.display.set_mode((1280, 720),FULLSCREEN)
|
23
|
+
pygame.display.set_caption("パイソン pygameで画像表示する")
|
24
|
+
image = pygame.image.load("z.jpg")
|
16
25
|
|
26
|
+
vx=vy=10
|
27
|
+
imageCosmos = pygame.image.load("x.png")
|
28
|
+
clock=pygame.time.Clock()
|
29
|
+
y = 720
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
def main():
|
34
|
+
while True:
|
35
|
+
clock.tick(60)
|
36
|
+
y = 720
|
37
|
+
screen.blit(imageCosmos,(0,0))
|
38
|
+
if -3000 < y:
|
39
|
+
screen.blit(image, (0,y))
|
40
|
+
y -= vy
|
41
|
+
|
42
|
+
pygame.display.update()
|
43
|
+
|
44
|
+
for event in pygame.event.get():
|
45
|
+
if event.type == QUIT:
|
46
|
+
pygame.quit()
|
47
|
+
sys.exit()
|
48
|
+
if event.type == KEYDOWN:
|
49
|
+
if event.key == K_ESCAPE:
|
50
|
+
pygame.quit()
|
51
|
+
sys.exit()
|
52
|
+
|
53
|
+
|
54
|
+
main()
|
55
|
+
```
|
56
|
+
|
17
57
|
### 試したこと
|
18
58
|
初心者なりに試行錯誤していますができていません
|