Skip to content

Instantly share code, notes, and snippets.

@AnimeshShaw
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save AnimeshShaw/b5d9a854e7e7651f5a28 to your computer and use it in GitHub Desktop.

Select an option

Save AnimeshShaw/b5d9a854e7e7651f5a28 to your computer and use it in GitHub Desktop.
Simple InfiniteTunnel with PyGame. More Details Visit : http://www.rawcoders.com/Thread-Source-Simple-InfiniteTunnel-with-PyGame
'''
Created on 21-Dec-2014
@author: Psycho_Coder
More Details Visit : http://www.rawcoders.com/Thread-Source-Simple-InfiniteTunnel-with-PyGame
'''
import os
import sys
import pygame
from pygame.constants import NOFRAME, QUIT, KEYDOWN, K_ESCAPE
def main():
pygame.init()
os.environ['SDL_VIDEO_CENTERED'] = '1'
resolution = width, height = ( 640, 480 )
screen = pygame.display.set_mode( resolution, NOFRAME, 32 )
pygame.display.set_caption( "Infinite Tunnel Simulation" )
rCBack = ( 27, 27, 27 )
screen.fill( rCBack )
while True:
for evt in pygame.event.get():
if evt.type == QUIT or ( evt.type == KEYDOWN and evt.key == K_ESCAPE ):
sys.exit()
screen.fill( rCBack )
mouse_pos = pygame.mouse.get_pos()
for x in range( 0, width, 20 ):
pygame.draw.aaline( screen, ( 255, 255, 0 ), ( x, 0 ), mouse_pos )
pygame.draw.aaline( screen, ( 255, 255, 0 ), ( x, 479 ), mouse_pos )
for y in range( 0, height, 20 ):
pygame.draw.line( screen, ( 255, 255, 0 ), ( 0, y ), mouse_pos )
pygame.draw.line( screen, ( 255, 255, 0 ), ( 639, y ), mouse_pos )
pygame.mouse.set_visible( False )
pygame.display.update()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment