Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How to up the score?
Old
zackpier
Guest
 
Status:
Posts: n/a
Exclamation How to up the score? - 04-23-2010, 06:30 AM

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)

Thanks
-Zack
Attached Files
File Type: a2w fly (1).a2w (4.45 MB, 8 views)
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-23-2010, 08:12 AM

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

http://www.alice.org/community/showthread.php?t=3755


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-23-2010, 09: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:

http://www.alice.org/community/showthread.php?t=4280

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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301

Last edited by Dameria; 04-23-2010 at 09:40 AM.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-23-2010, 10:29 AM

Now your trying to step on my toes


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames

Last edited by jediaction; 04-23-2010 at 10:44 AM.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-23-2010, 10: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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-23-2010, 10:35 AM

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


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-23-2010, 10: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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-23-2010, 10:44 AM

Oh yah? I should start using increamenting by 1 more


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-23-2010, 10: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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-23-2010, 12:27 PM

Quote:
Originally Posted by Dameria View Post
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.
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.


(')>
   
Reply With Quote
Reply

Tags
flight, fly, plane, score, simulator

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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