Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import sys, pygame
- from pygame.locals import *
- positionX = 200
- positionY = 10
- pygame.init()
- pygame.display.set_mode((800, 600))
- pygame.display.set_caption("new engine dev demo - noda creator 0.1")
- window = pygame.display.get_surface()
- window.fill((128, 128, 128))
- Platform = pygame.Surface((800, 200))
- Platform.fill((100, 100, 100))
- window.blit(Platform, (1, 500))
- Block = pygame.Surface((100, 100))
- Block.fill((50, 50, 50))
- pXY = Block.get_rect()
- pXY.x = positionX
- pXY.y = positionY
- window.blit(Block, (positionX, positionY))
- pygame.display.flip()
- fps = pygame.time.Clock()
- while True:
- for happend in pygame.event.get():
- if happend.type == QUIT:
- sys.exit(0)
- if happend.type == KEYDOWN:
- if happend.key == K_a:
- pXY.x-=10
- window.blit(Block, pXY)
- pygame.display.update()
- window.fill((128, 128, 128))
- if happend.key == K_d:
- pXY.x += 10
- window.blit(Block, pXY)
- pygame.display.update()
- window.fill((128, 128, 128))
- pXY.y+=10
- window.blit(Block, pXY)
- pygame.display.update()
- window.fill((128, 128, 128))
- fps.tick(60)
- Platform = pygame.Surface((800, 200))
- Platform.fill((100, 100, 100))
- window.blit(Platform, (1, 500))
- if pXY.y == 400:
- break
- while 1:
- for happend in pygame.event.get():
- if happend.type == QUIT:
- sys.exit(0)
- if happend.type == KEYDOWN:
- if happend.key == K_a:
- pXY.x-=10
- window.blit(Block, pXY)
- pygame.display.update()
- window.fill((128, 128, 128))
- if happend.key == K_d:
- pXY.x += 10
- window.blit(Block, pXY)
- pygame.display.update()
- window.fill((128, 128, 128))
- Platform = pygame.Surface((800, 200))
- Platform.fill((100, 100, 100))
- window.blit(Platform, (1, 500))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement