Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Flash Game + Awarding Points

Posted on 2004-07-31
Medium Priority
238 Views
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
Question by:dkilby
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 9

Expert Comment

ID: 11686858
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

ID: 11689448
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

ID: 11693101
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

snoldak924 earned 2000 total points
ID: 11693110
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

ID: 11711396
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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
###### Suggested Courses
Course of the Month8 days, 18 hours left to enroll