Solved

Flash Game + Awarding Points

Posted on 2004-07-31
5
193 Views
Last Modified: 2010-04-03
I am trying to create a Flash game where the player will try and guess where an object is.  I have a timer and what i want to do is award points each player depending on the distance to the actual object and depending on how quick they made the guess.  I have the distance figured out and of course the time.  But i can not figure out how to award points.  I want the person with the closest guess in the shortest amount of time to have the most points.

Thanks for the help
0
Comment
Question by:dkilby
5 Comments
 
LVL 9

Expert Comment

by:j3one
Comment Utility
you could use a "dart-board" type scoring system, well sort of. More like a hit area of grids, and any click witin that area would be worth X amount of points.

In other words instead of calculating the distance by pixels, then reversing the point structure so that a higher number(distance eg. 70) = lower points, wheras a closer number(pixel eg. 30)....
You can just have a grid set up where if the object is in the top left corner, and you had 25 grid sections, you would give higher point valuse to the grid areas closest to the left corner object, and decrease them as you progresed to the bottom right corner.

-> Just an idea, j3one
0
 

Author Comment

by:dkilby
Comment Utility
i have thought about that, but really want to go with a distance and time system.  Just can't figure out the best calcuation of doing it.
0
 
LVL 2

Expert Comment

by:snoldak924
Comment Utility
just add mouse coordinate variables that are set when the user clicks:
on(press){
mousex=...
mousey=...(forget at the the moment how to get mouse pos ;)
}

Then, use distance formula, d=(mousex-objectx)^2+(mousey-objecty)^2)^(1/2) to figure out the distance from mouse click to object.  Then, just use a simple (scene dimension-distance) for points.

Tell me if you need more clarification,
0
 
LVL 2

Accepted Solution

by:
snoldak924 earned 500 total points
Comment Utility
oops, forgot about time.  Just start the timer when the scene loads, and stop it when the user clicks.  Then just use it in your formula (scene dimension-distance)*(max time-user's time)
0
 
LVL 9

Expert Comment

by:dutchfoxer
Comment Utility
Sounds like the game with a football picture/photo where you see the football players but not the Ball. You need to click on the photo where you think the ball is.

So you know distance and time right? At time of click you have logged the x and y position of mouse and compared it to correct location x and y!? And you know after how many seconds.

* If distance is 0, then spot on. The lesser the distance the greater the score.

* If time is 0 then superfast. The longer the lesser the score.

So you have 10 points for starters, minus the seconds it took, minus the distance. And maybe an IF-Statement in case the score is a negative number, then score = 0 (with text for gamer "your terrible, fool!")

score = 10 - distance - duration

Sounds okay?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now