Alice Community

Alice Community (
-   How do I...? (
-   -   How to up the score? (

zackpier 04-23-2010 07:30 AM

How to up the score?
1 Attachment(s)
This is my second question on this project. I am almost completely finished but I would like to know how I can implement a score into my world. I have it split between two 3d text's. ("Score:" and "0"). What would I use to make it to where for every second the player doesnt crash, the score goes up? (My game is kinda like a flight simulator? just has a plane flying)


jediaction 04-23-2010 09:12 AM

I made an example once on this. Its the second comment on the page


Dameria 04-23-2010 10:27 AM

Or you can see the maze that I created for this person. It has exactly what you have, a text for "Score:" and a text for "0", and 0 increments by 5 every time a lollipop is clicked on. Then at the end you get a time bonus that increases your score:


I'm sorry jediaction, but mine is a lot better than yours. Yours would take way too many if/else statements where as mine is just 2 lines of code repeated every time you score a point. Yours is just too space-consuming, and with a large game it would considerably increase the file size.

jediaction 04-23-2010 11:29 AM

Now your trying to step on my toes:mad:

Dameria 04-23-2010 11:35 AM

Hey, I'm just saying that yours takes a lot more work than it needs to be. Also, this way the score can be kept as a variable that can be accessed by other methods later on whereas if it just kept changing the text, and it would make things harder from there.

jediaction 04-23-2010 11:35 AM

I realized that but im best at my way. End of conversation

Dameria 04-23-2010 11:39 AM

What do you mean your best at your way? Programmers use integer and double variables when counting scores, they don't just change text. Your way doesn't use variables at all.

jediaction 04-23-2010 11:44 AM

Oh yah? I should start using increamenting by 1 more

Dameria 04-23-2010 11:49 AM

Yes that is a very useful thing in programming, or also if you want to increase something by more than one you just do variable = variable + 10 (or any other number) and then with that number you can do all sorts of mathematical equations to determine things within your program. Because Alice is for beginners, not many people use integers, they mainly use the objects and methods written for them. Variables are one of the most important parts of good programming though, and the Alice community should start using them more often if we want to start making more realistic games.

x2495iiii 04-23-2010 01:27 PM

[QUOTE=Dameria;20222]Variables are one of the most important parts of good programming though, and the Alice community should start using them more often if we want to start making more realistic games.[/QUOTE]

He's right. We have to be open to new ideas in order to learn to become truly good programmers.

For example: when I was in advanced programming, we had to make this keno game program as one of our assignments. As some of you may know, keno involves lots of squares with numbers which the user has to click to choose what numbers he thinks will be randomly generated by the computer. Every single one of my classmates instantly got to work making massive nested if/else if statements to set up hotspots for the squares, but I couldn't help but think there was an easier way, so I sat and thought about it while they worked. When they were about 1/4 of the way done, I discovered a formula that would easily calculate coordinates for equal sized and spaced squares on a 800x600 pixel frame (and save about 500 lines of code), and with that formula I was able to finish before they did and get extra credit for thinking outside the box.

Moral of the story: just because you know it already doesn't make it the best thing to do.

All times are GMT -5. The time now is 12:27 AM.

Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.