lonestar

0x10c-inspired space game based on the DCPU-16
git clone git://squid-tech.com/lonestar.git
Log | Files | Refs | README

commit e08154a9f36542982ac66d8e10c8d75d6322df51
parent 7ae8b2275dce4dbaaf848c725a6edc9e9e8c9bf6
Author: Josh Moore <jxm5210@rit.edu>
Date:   Sun, 24 Nov 2019 18:00:15 -0500

Fix render order issues, add shipdraw gitignore

Diffstat:
Autils/shipdraw/.gitignore | 2++
Mutils/shipdraw/shipdraw.py | 18+++++++++++-------
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/utils/shipdraw/.gitignore b/utils/shipdraw/.gitignore @@ -0,0 +1 @@ +Ships/+ \ No newline at end of file diff --git a/utils/shipdraw/shipdraw.py b/utils/shipdraw/shipdraw.py @@ -129,18 +129,13 @@ while not done: # draw background screen.fill((220,220,220)) - # draw point grid - if drawgrid: - for x in range(0, SCREEN_WIDTH + 1, GRID_STEP): - for y in range(0, SCREEN_HEIGHT + 1, GRID_STEP): - pygame.draw.circle(screen, (100,100,100), (x, y), 2) + unitMousePos = tuple(round(i / GRID_STEP) for i in pygame.mouse.get_pos()) # draw grid cursor for both the mouse position and last placed hull point # also draw preview to next point if drawingHull: drawOutline(shiphull, False) - - unitMousePos = tuple(round(i / GRID_STEP) for i in pygame.mouse.get_pos()) + hullCursor(unitMousePos) if len(shiphull) > 0: hullCursor(shiphull[-1]) @@ -150,5 +145,14 @@ while not done: else: pygame.draw.polygon(screen, (200,200,200), scaledhullpoints) pygame.draw.polygon(screen, (0,0,0), scaledhullpoints, 3) + + # draw point grid + if drawgrid: + for x in range(0, SCREEN_WIDTH + 1, GRID_STEP): + for y in range(0, SCREEN_HEIGHT + 1, GRID_STEP): + pygame.draw.circle(screen, (100,100,100), (x, y), 2) + + if drawingHull: + hullCursor(unitMousePos) pygame.display.flip() \ No newline at end of file