Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Flash Game + Awarding Points

Posted on 2004-07-31
5
Medium Priority
?
241 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
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

by:dkilby
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

by:snoldak924
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

by:
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

by:dutchfoxer
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
Suggested Courses

782 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