-
score control (thread 1)
Hi all! I am new to this...so bare with me...and give me all the help please because I am stuck big time!
Ok...I am creating a small homework game, it might be small but seems difficult...
I am dragging and dropping 4 dots to specific 4 places. If one dot is placed to a correct place (one of four places) the user gets one point added to his score (total correct are 4). That means the game is over when the four dots have been placed at the 4 correct places and the user gets 4/4 score. If one dot is placed to a wrong place( total wrong places are 16), the user gets one point off his score.
Firstly: How do I control the score so that the user does not get more than one point or less than one point at each mouse Release of the dot at a specific place either that is Right or Wrong?
...continue in thread 2
-
You really only needed one thread for these questions.
Before answering your first question, I'd like to see a quick jpeg showing what your game might look like (that might affect my answer - are the positions arranged in a regular grid, for example?)
As far as the second question goes - do you want the user to see the score changing as they try different positions, or do you want to wait till the user has made some kind of permanent choice (or set of choices) before showing the score to the user?
-
score control (continue)
Hallo there! Thank you for trying to help me!
Ok. I put a picture up (a simple template). Correct places of dots: 1 should match A, 2 should match B, etc.
As you see..it is arranged in a grid...and I want the score to be showing while the user changes places around.
Hope you can help me...
Thank you very much.
:-) Evelyne
-
Some useful elements for this type of game:
A 2-dimensional grid showing correct and incorrect spots, and the affect these spots have on the score:
Code:
myGrid = [ [ 1, -1, -1, -1],
[ -1,-1, 1, -1],
[ -1, 1, -1, -1],
[ 1,-1, -1, -1]];
// note the 4 positive ones where the correct
// positions are
myGrid[y][x] gives you the score for that square.
Start your score at zero.
score =0 ;
When adding a dot to a square, you can do this:
score = score + myGrid[y][x];
And when removing a dot from a square, you can do this:
score = score - myGrid[y][x];
In both cases, the score will correctly reflect what it needs to reflect.
Finally, you may need a method to convert mouse coordinates (_xmouse,_ymouse) to grid coordinates (y,x).
Assuming your grid starts at pixel coordinates ox,oy and has cell dimensions of tw,th, the formula is:
gridy = (_root._ymouse - oy) / th;
gridx = (_root._xmouse - ox) / tw;
Going backwards (grid coordinates to screen coordinates)
x = grid*tw + ox;
y = grid*th + oy;
As you can see, this kind of problem is ultimately about data representation. Finding a good data representation for your problem (the 2d array in this case) often makes the difference between a long, complicated program and a short, simple one.
You will get better at finding these good data representations with experience, something you won't get much of, if you keep going to these message boards for help with your homework. :)
- Jim
-
Thank you
Thank you very much Jim...I will try to do so...I had been trying so far with the if..else...statement and with enabling and desabling movie clips as an effort of trying to control the score...and got kind of confused...no experience with arrays yet...but hope I can make it.
Thank you very much,
:) Evelyne
-
-
-
This is a question considering score bars...I have this game, and I need the score to go up by one when it "eats" an apple (hitTest man-apple). I have no problem getting the apple "eaten", but I still need a score. What I did with my other small games, is just make a scorebar movieclip, then a bunch of frames with each one going up by the interval I want...but that would take WAY too long for this game.
-I want the user to see his score
-I made the score a dynamic text, called it scorebar
So I hope you can help me with this score type thing. Also, this isn't a tile based game...