TILEWORLDS OVERVIEW Basically A palette of chunks stitch

TILE-WORLDS

OVERVIEW • Basically: • A palette of "chunks" • stitch together to make worlds • Old-school • Mega-man • Legend of Zelda • (anything SNES / GB / etc. ) • New-school • Harder to spot…and it's 3 d • Unity "Prefab" / Unreal "Blueprint"

INTRO TO TILED • Download it (at home / on laptop): http: //www. mapeditor. org/ • Tutorial: • Get Net. Hack images (from https: //bilious. alt. org/~paxed/nethack/nhsshot/tilecmp. php) • I'm using the 32 x 32 version • 40 tiles wide, 27 rows (last one is partial) • Add tileset layer • Lay down a few tiles • Export as a flare. txt file

PYTHON (TEXT) FILE WRITING read / write calls fp = open("test. txt", "w") file object fp. write("Hellon") x = 7 fp. write("x = " + str(x) + "n") python. exe fp. close() File. System (NTFS / FAT / etc) Device Driver Hardware Controller Physical Mechanisms Other python paths c: \temp\test. txt /usr/local/test. txt sub\test. txt # BAD!
![HANDY STRING METHODS >>> S = " abc 7 ghi >>> S[2] 'a' >>> HANDY STRING METHODS >>> S = " abc 7 ghi >>> S[2] 'a' >>>](http://slidetodoc.com/presentation_image_h2/9787da4fd5a26d62d86cd81dd6ab6e36/image-5.jpg)
HANDY STRING METHODS >>> S = " abc 7 ghi >>> S[2] 'a' >>> S[-4] 'i' >>> S[2: 6] 'abc ' >>> S ' abc 7 ghi ' >>> S. strip() 'abc 7 ghi' >>> S ' abc 7 ghi ' >>> S = S. strip() " >>> L = S. split(" ") >>> L ["abc", "7", "ghi"] >>> L[1] + 3 ERROR! >>> int(L[1]) + 3 10

PYTHON (TEXT) FILE READING fp = open("test. txt", "r") if fp != None: # Treat the file as a sequence of strings for line in fp: # Gets rid of trailing 'n' line = line. strip() # Process line # [The HARD work] # Close the file fp. close()

REVIEW OF 2 D LISTS IN PYTHON • Doing it all at once L = [["a", "b", "c"], ["d", "e", "f"]] • Doing it iteratively L = [] L. append(["a", "b", "c"]) L. append(["d", "e", "f"]) • Accessing print(L[0]) print(L[0][-1]) print(L[1][2]) # ["a", "b", "c"] # a # c # f • Printing all (as a matrix) s = "" for row in L: for item in row: s += item + " " s += "n" print(s)

REFRESHER ON PYGAME BLITTING • blit = copy (part of) one surface to another screen = pygame. display. set_mode((800, 600)) fimg = pygame. image. load("fallout. bmp") zimg = pygame. image. load("zelda. png") screen. blit(zimg, (50, 100)) # Blit all screen. blit(fimg, (400, 100), 212 (200, 130, 250, 212)) # Blit some 250 fimg (200, 130) 500 (400, 100) (50, 100) 700 zimg 600 400 800 screen 200
- Slides: 8