Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
main_game
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#python 3.5.2 print ("Hello, world!") ''' Snake game to use some python code ''' import pygame #Define colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) pygame.init() size = (700, 400) screen = pygame.display.set_mode(size) pygame.display.set_caption("snake 2") CLOCK = pygame.time.Clock() #Loop until the final done = False while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True #Game logic here #Screen cleaning''' Snake game to use some python code ''' import pygame #Define colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) pygame.init() size = (700, 400) screen = pygame.display.set_mode(size) pygame.display.set_caption("snake 2") CLOCK = pygame.time.Clock() #Loop until the final done = False while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True #Game logic here #Screen cleaning #Here screen to while #IF background image plece it here screen.fill(WHITE) #Drawing code here pygame.draw.line(screen, GREEN, [0, 0],[100, 100], 55) #Update the screen pygame.display.flip() #limit frames CLOCK.tick(60) #Close window pygame.quit() #Here screen to while #IF background image plece it here screen.fill(WHITE) #Drawing code here pygame.draw.line(screen, GREEN, [0, 0],[100, 100], 55) #Update the screen pygame.display.flip() #limit frames CLOCK.tick(60) #Close window pygame.quit()
[
+
]
Show input
edit mode
|
history
|
discussion