Monday, May 30, 2011

Mouse and Shooting

Mouse:
To get information on a mouse click, you use Greenfoot.getMouseInfo(). Now if you store this in a int, you can do all sorts of things. For instance, you can get the mouse x and y coordinates of where you clicked or last click. You can also make things follow the mouse. Using move() along with mouseinfo, you can use your mouse to move instead of using arrow keys which he had previously used.


Shooting:
Shooting is very simple. Basically all you do is make an object appear on the grid and make it move. To make it seem like its shooting from a certain object, you just need to get the location of that object and create the object there or near it, and then make it move using the move(//put a double here). The move() will have to be inside the class thats supposed to be the bullet or whatever you're shooting. To make it disappear, you just have to use .removeobject(). You can also then place a new image of where the object disappeared to make it seem like you shot something.


Working on:
We need to create an enemy that we can shoot down. What I currently don't understand is how to do contact with one class with another. We think that we can simply modify the eatleaf thing that was given to us in the wombat class in order to achieve this goal. Shyam thought that we should create a frogger game. I don't know what that is, so I will have to play a few before I know what he's talking about.


This week will be SOL week for us in school. That means that we will have SOL's in the morning and then classes in the afternoon. Therefore, we will not be able to make it to the career center the entire week. However, we will continue to work on it at home.

No comments:

Post a Comment