This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
2d pixel-perfect collision detection | |
Requires that each object has a rectangular bounding box (simple x/y/w/h, no rotation) | |
and a bit mask (i.e. an array of lines and columns containing 0s for empty pixels and 1s for solid pixels). | |
On each frame of the animation, take all pairs of objects and | |
1. compare the bounding boxes | |
2. for those that collide, check for overlayed bits by creating a new mask that is the AND of the 2 sub-masks and check for 1s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, os, re | |
class FileNameComplete(sublime_plugin.EventListener): | |
def on_query_completions(self, view, prefix, locations): | |
completions = [] | |
sel = view.sel()[0].a | |
if "string" in view.syntax_name(sel): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Visitor(object): | |
CHILD_ATTRS = ['value', 'thenPart', 'elsePart', 'expression', 'body','exception', 'initializer', 'tryBlock', 'condition','update', 'iterator', 'object', 'setup', 'discriminant', 'finallyBlock', 'tryBlock', 'varDecl', 'target'] | |
def __init__(self, filepath): | |
self.filepath = filepath | |
#List of functions by line # and set of names | |
self.functions = defaultdict(set) | |
with open(filepath) as myFile: | |
self.source = myFile.read() |