If you already have experience with Java and Greenfoot, you can download a course I wrote:
http://www.2shared.com/document/fK0wPwlQ/Learning_Greenfoot_22.html
I wrote this course for people who want to upgrade their skills to Greenfoot 2.2, and that includes using the new Highscore APIs (class PlayerData) in Greenfoot 2.2.
I love to hear what you think about it (if you're going to use it)
first of all go to the page that spower said and follow his course (add all of the class you need, copy and paste works well)when you do that if it doesent work post your code and ill have a look
ok??
:)
look this is the code I have but er is a bug or something like that. because there stay can not find playerdata class
I hope you can help me nic
import greenfoot.*;
public class Saver
{
private PlayerData player;
public Saver()
{
if (concierge.isStorageAvailable() ) {
if (concierge.getMyData() != null) {
concierge = PlayerData.getMyData();
}
}
}
public void saveHighscore(int score)
{
if (concierge.isStorageAvailable() ) {
if (concierge !=null) {
if (score > concierge.getScore() ) {
concierge.setScore(score);
concierge.store();
}
}
}
}
}
private PlayerData player;
here you put player but lower you put concierge??
also
if (concierge.getMyData() != null) {
i put
if (PlayerData.getMyData() != null) {??
see
also futher down you put
if (concierge.isStorageAvailable() ) {
i put
if (PlayerData.isStorageAvailable() ) {
hope this helps:)
hey nic I follow your tip but er is still something wrong because if I pus on compile er is a bug namely
cannont find symbol- PlayerData
this is the new code I hope you can gif me an other tip
import greenfoot.*;
public class Saver
{
private PlayerData player;
public Saver()
{
if (concierge.isStorageAvailable() ) {
if (PlayerData.getMyData() != null) {
concierge = PlayerData.getMyData();
}
}
}
public void saveHighscore(int score)
{
if (PlayerData.isStorageAvailable() ) {
if (concierge !=null) {
if (score > concierge.getScore() ) {
concierge.setScore(score);
concierge.store();
}
}
}
}
}
ABSOLUTELY don't say:
congierge.isStorageAvailable()
!!!!!!!!!!!!!!!!!!!
Only the PlayerData class has the isStorageAvailable() method, why would congierge can save your highscore?????!!!!!!!
This wasn't really smart of you......
I´m sorry for upsetting but I´m not the best progammer on the world
but I changes the code but it stil not working
if I compile it er stay again cannont find symbol- PlayerData
I hope both of you can help me with
import greenfoot.*;
public class Saver
{
private PlayerData player;
public Saver()
{
if (PlayerData.isStorageAvailable() ) {
if (PlayerData.getMyData() != null) {
PlayerData = PlayerData.getMyData();
}
}
}
public void saveHighscore(int score)
{
if (PlayerData.isStorageAvailable() ) {
if (PlayerData !=null) {
if (score > PlayerData.getScore() ) {
PlayerData.setScore(score);
PlayerData.store();
}
}
}
}
}