SnapCode Update April 18: Added Hit Detection

This week added some hit detection methods to the SnapActor class:


This makes it possible to determine whether a given actor overlaps (or “hit”) another actor and will be useful for most games. Additionally, we updated the KeyDown and KeyClicked functionality to handle multiple down/clicked keys at once – because it turns out that real gameplay often involves this (head-smack).

Early next week I’ll release our test case – a JavaFX/SnapCode version of asteroids. Below is the full list of improvements made to SnapCode this week.

– SnapActor: Added getIntersectingActor/getIntersectingActors
– SnapActor: Added getActorsInRange
– SnapScene: Fixed KeyDown to be a Set of KeyCodes instead of just one
– SnapActor: Fixed to have X/Y be at center of actor
– SnapAnimator: Fixed to animate X/Y instead of LayoutX/Y
– SnapAnimator: Added moveTo()
– SnapScene: Made default scene have main() and act() methods
– SnapPartStmt: Fixed dropNode on bottom of block statement
– SnapActor: Fixed setWidth/setHeight to preserve x/y
– SnapActor: Added getDistance(actor)
– SnapScene: Added removeActor()
– SnapScene: Made playSound() check /sounds directory
– SnapScene, SnapActor: Renamed MousePressed/KeyPressed methods to be MouseDown/KeyDown.


One Response to “SnapCode Update April 18: Added Hit Detection”

  1. Java desktop links of the week, April 21 « Jonathan Giles Says:

    […] Jeff Martin has updated SnapCode (the IDE and RAD tool for education, entertainment and the enterprise), to add hit detection and more. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: