Computer Science Canada Mouse.where / if statements |
Author: | Jessica359 [ Mon Mar 10, 2008 3:43 pm ] | ||
Post subject: | Mouse.where / if statements | ||
Hey, for this program I have 2 problems. #1 In my introduction after the flash screen it says please write go to continue but i want to get the user to click on the beaver instead. I vagely remember doign something like that last year using mouse.where or GUI something like that, i really don't remember. #2 At the end we have to show the outcome of the user's score with a graph. I want a certain graph to show up with a certain score. I don't know if i'm doing my if statements wrong or if its jsut not possible? I have a few more glitches to work out but those 2 are the main problems. Thanks ![]()
|
Author: | Sean [ Mon Mar 10, 2008 5:19 pm ] |
Post subject: | Re: Mouse.where / if statements |
Well, for #1, you are wanting to click the Beaver, trace it's x and y coordinates and have the mouse click anywhere between it. |
Author: | A.J [ Mon Mar 10, 2008 5:43 pm ] |
Post subject: | Re: Mouse.where / if statements |
And for #2, I don't see where the user's score is stored? (I am sry, but I am kinda in a hurry ![]() But Iwould advise you to make a save/load option. PM me or just ask me when you finally give up ![]() A.J |
Author: | Jessica359 [ Mon Mar 10, 2008 7:04 pm ] |
Post subject: | RE:Mouse.where / if statements |
For #1, i know the coordinates so i would use what? Mouse.where? For #2 score is stored as "s". This is really confusing! :S ![]() |
Author: | Jessica359 [ Tue Mar 11, 2008 1:52 pm ] |
Post subject: | RE:Mouse.where / if statements |
Alright, So far i got everything the way i wanted it except for the graph, i am still stuck on it. Is there a way mayby int he if statement to say that if score is greater then 90 and less then 80 put ... thanks ![]() |
Author: | Sean [ Tue Mar 11, 2008 2:16 pm ] |
Post subject: | Re: Mouse.where / if statements |
What type of graph are you attempting to accomplish? |
Author: | Jessica359 [ Tue Mar 11, 2008 5:57 pm ] |
Post subject: | RE:Mouse.where / if statements |
A bar graph, that depending on the user's score it will display a different bard graph. Like if the user gets a 40% you will see 2 bars, the one that says "wrong" will be higer then the one that says "right". |
Author: | syntax_error [ Tue Mar 11, 2008 7:04 pm ] |
Post subject: | RE:Mouse.where / if statements |
look up draw.box |
Author: | Sean [ Wed Mar 12, 2008 6:52 am ] |
Post subject: | Re: Mouse.where / if statements |
Draw.FillBox should be used. You will want it to check the total score, then draw a graph according to the percentage, so you should have the same width of the bar, but they 2nd Y co-ordinate that effects the height should be minipulated depending on the percent of how much you got right or wrong. |
Author: | A.J [ Wed Mar 12, 2008 12:02 pm ] | ||
Post subject: | Re: Mouse.where / if statements | ||
Vilament is right. Draw.FillBox can be used in creating the "life increasing" part here's a simple (and crude) example:
Tell me if this helps, as it may not be what you're looking for ![]() |
Author: | Jessica359 [ Wed Mar 12, 2008 7:17 pm ] |
Post subject: | RE:Mouse.where / if statements |
Ya i get what you guys mean but i think i'm doing something wrong in my if statements or would case construct work better in this case? Or probably the asnwer is sitting right in front of me and I am completely blind ![]() ![]() |
Author: | A.J [ Wed Mar 12, 2008 7:39 pm ] |
Post subject: | Re: Mouse.where / if statements |
I don't think any of your if statements are the problem. For #1, just Draw a bow around the beaver and check if the user clicks anywhere in the box using the co-ordinates of the mouse to see if they are in range. For #2: Your bar graph looks okay, but if you want to add things like numbers showing how many the person got wring, just add the numbers beside our graph so that people will know the indexing of your graph. I know, I know...don't tell me.. I MAKE NO SENSE!! just see if this what u wanted ![]() A.J |
Author: | Sean [ Wed Mar 12, 2008 9:36 pm ] |
Post subject: | Re: Mouse.where / if statements |
I agree with A.J. The if statements are not the problem, they are fine. I suggest drawing an invisable box, or a black box around it, so they know where to click. You'll want to check the starting x co-ordinate, to the end x co-ordinate, then the y's. If the click is in the box, or the dimension, then it should work. |
Author: | Jessica359 [ Thu Mar 13, 2008 10:35 am ] |
Post subject: | RE:Mouse.where / if statements |
Awesome! thanks to both of you I got #1 working but #2 still is a blank. If you look at the program i put out up in my first post, if the user gets 100 it should ouput 2 specific bars, one that outputs how much he got right and another of how much he got wrong. But the only graph thats working is if the suer gets 0 as a score. any otehr score the graph doesn't work. For teh if statements I told it to that if the score is (some much) then ouput these 2 bars but I have no clue why its not working. Instead of saying if score is greater then 90 then out this graph would there be a way to say if score is in between 90 and 100 then put this graph? Sorry if i'm not making any sense and if i'm not getting what ur saying ![]() Once somehow this is figured out its probably gunna be a dum blond thing as usual ![]() thanks for all your help sory if its frustrating ![]() |
Author: | A.J [ Thu Mar 13, 2008 10:54 am ] | ||
Post subject: | Re: Mouse.where / if statements | ||
I finally get what you are looking for ![]() instead of what you did, I think this will be better :
This way, you don't have to check every single possibility of s. This checks the percentage of correct answers (s/13) and finds that many percent of 490 (since 490 covers the full screen). So if the person gets 13 (perfect!)the bar graph would be (13/13)*490, which covers the full screen. Another mistake of yours is if a person gets perfect, you draw the 'wrong' graph also! you SHOULDN'T do that. If a person gets everything wrong or everything right, you shouldn't draw the other graph at all. So, I checked if s=0 or s=13 and I only drew the appropriate graph. Tell me if this helps ![]() A.J |
Author: | Jessica359 [ Thu Mar 13, 2008 1:00 pm ] |
Post subject: | RE:Mouse.where / if statements |
YAY! YAY! YAY! ![]() AWESOME! -woot- perfect, thats exactly it! ![]() Thanks a bunch! ![]() Now I get to move on to my next project which is to make a game, but I hve to find some idea first! ![]() Thanks again! ![]() Jess |
Author: | A.J [ Thu Mar 13, 2008 1:22 pm ] |
Post subject: | Re: Mouse.where / if statements |
I'd say make a 2D tile based game, like snake perhaps? take look at this game i made (not too good, it took me an hour to make it) but it should give you a basic idea! check out the walkthrough of 2D tile based games at the Turing Walkthrough section. it is by CodeMonkey 2000. And your welcome, I'm glad i was of any use to you ![]() A.J (P.S:Use arrow keys for the game and you can control the speed by holding 'z' to go faster and 'x' to go slower. Also, you can change the map by changing the text file, 'I' are for walls, 'P' for points and numbers from 1-5 for the snake. Have fun:D) |
Author: | Jessica359 [ Thu Mar 13, 2008 8:59 pm ] |
Post subject: | RE:Mouse.where / if statements |
Awesome! Thanks for the idea. I sure i'll have some other problem that will pop up on Turing soon! Thanks again! |
Author: | A.J [ Fri Mar 14, 2008 12:21 am ] |
Post subject: | Re: Mouse.where / if statements |
you're welcome ![]() glad someone understood me ![]() |
Author: | Jessica359 [ Fri Mar 14, 2008 6:08 pm ] |
Post subject: | RE:Mouse.where / if statements |
It took a while but it worked ![]() |