Okay I've got another one. I want to setup a scoring system and I feel like I'm pretty damn close ... but just can't seem to figure something out. A brief overview:
I've got a super class with a check and set score method:
From here we move to my player class which is eating things, increasing a score variable, and then calling the setScore() method and passing the score within it:
This all seems to work correctly, here comes the part that I believe is broken. I now move to my score class where I call getScore() which should return whatever the score via Gscore. Problem is, it doesn't seem like it does at all. Here's what 've got in my score class essentially:
everything compiles great, and my brain says this should work. Someone show me the error of my ways! Much appreciated :)
public int Gscore = 0; public void act() { public void setScore(int score) { Gscore = score; } public int getScore() { return Gscore; } }
score = score + 1; setScore(score);
int score = getScore(); if (score == 1) { setImage("images/1.png"); }