Not bad! :) Though it'd be nice if pressing multiple keys at once would make it move diagonally (i.e. w + a --> towards the top left). You'll simply need to check all the keys in separate if-statements, instead of making it 'else if' clauses, and then use setLocation(getX() +something, getY() +somethingelse), depending on whether you're moving to the left, right, up or down.
Though you don't necessarily need to change the code for actually moving it, but it would be easier in my opinion (plus, less CPU intensive: rotating, though you don't notice it here, can be costly).
This app was created by an awesome software at Legend High School in Parker Colorado. Thank you for all the comments and feedback.
Does anyone know how to get the missiles to follow the rotation set for each? In other words, he was having issue getting the missiles to move towards the set rotation. That is why the end looks funny. Ideally, the missiles would go the direction the end piece is pointing. He was unable to get anything other than 45 degree angles or straight. I can't figure it out. Thanks!
@DStasiak, for the missile movement, there are a couple of ways to handle it. One is to track the coordinate locations using 'double' fields (greenfoot uses 'int' fields which is why only multiples of 45 are achieved when moving one pixel at a time). The other way is to have the missiles hold their starting location and count the steps it takes so you can increment the step, relocate back to the original location and move a greater distance each time.
@DStasiak, I just updated my Global Defense game to allow users to view class codes without having to be logged in on the site. You may want to view the Missile class code in it.
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/24
2016/5/25
2016/9/5
2016/9/15