This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

jimboweb
jimboweb presents ...

2014/11/8

Jims_Useful_Classes

A collection of useful classes allowing your actors to do common things.

Easy to copy a class into your project and use as is.

Current version includes the following classes:
MoveWithArrows - Make an actor move with arrow keys.
MoveWithMouse - Make an actor move with the mouse. A bit buggy.
RemoveObjectOnCollision - Remove an object when you touch it. Put it on a bad guy and they will take you out!
Projectile - Shoot a projectile that destroys other actors. Can be a generic laser or an image.
StaticText - Print a static piece of text, like "Game Over."
ScoreBoard - Keep a scoreboard that can be increased, decreased, reset, etc.
FollowActor - Make an actor follow another actor. Good for bad guys!
MoveObstructedByObstacle - Move an actor with arrows or mouse, but blocked by objects of a certain class, like a wall. Good for maze games!
MoveRandomly - Make an actor move in a random way. Also good for bad guys. Can be obstructed by obstacles.
HealthBar - A bar to keep track of your health or other objects. Instructions to make it decrease on collisions with other actors.
DriftMove - A versatile class allowing you to drift (as in the old Asteroids game). Also includes methods allowing you to bounce or wrap at end of screen, bounce of other objects, accelerate and move smoothly, and fall.

Simply copy the class you want to use from this project into the project you want to use it in. Detailed instructions as to how to use it are included in the documentation.

Most classes are extensively documented so you can change them.

This is published under Creative Commons license. You can change any of these classes and share them with anyone, but please credit me. You cannot sell them to anyone for money.

3265 views / 15 in the last 7 days

Tags: mouse demo with-source

open in greenfoot
Your browser does not support the canvas tag.
LifeslayerLifeslayer

2014/11/8

I am trying to make the health bar and it is not working. I am using the first one and this is what I get "Expected ";"" When I try to put in Actor theActor and intHealth
jimbowebjimboweb

2014/11/9

You need to put a semicolon at the end of the line in Java.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.