Another Button Problem :(
Author |
Message |
Sam_sam
|
Posted: Mon Jan 05, 2009 6:37 pm Post subject: Another Button Problem :( |
|
|
Well, this time I got a lot futher. If you don't know what I am talking about you can
refer to Post: How to make button help!?!
Now, I am trying to enable my "customers" to be able to click on an image, and it has to activate in response
by showing information on it. This is what my code looks like so far, don't mind the commented out ones. I really need help with the uncommented ones.
Turing: |
% Pic.ScreenLoad ("Chic.jpg",21 , 227, picCopy)
% loop
% delay (1000)
%
% var x, y, buttonnumber, buttonupdown : int
% buttonwait ("down", x, y, buttonnumber, buttonupdown)
% put x
% put y
% end loop
%---------------------% WELCOME %---------------------------%
var x, y, buttonnumber, buttonupdown : int
var fontPapyrus : int
var fontArial : int
var fontArial1 : int
setscreen ("graphics")
colorback (yellow)
cls
fontPapyrus := Font.New ("Papyrus:30:italic")
fontArial := Font.New ("Arial:12:italic")
fontArial1 := Font.New ("Arial:12:bold")
Font.Draw ("Welcome to The Chicken Wing ", 32, 345, fontPapyrus, 1)
Font.Draw ("Factory", 216, 277, fontPapyrus, 1)
Font.Draw ("\"Once you come, you'll never go back\"", 272, 58, fontArial, 1)
Pic.ScreenLoad ("chicken.jpg", 0, 0, picCopy)
delay (2000)
cls
%--------------------% OVERVIEW %--------------------------------%
drawbox (15, 181, 214, 349, 1)
drawbox (361, 182, 611, 348, 1)
drawbox (22, 22, 221, 167, 1)
drawbox (358, 23, 556, 173, 1)
Pic.ScreenLoad ("Chic.jpg", 15, 182, picCopy)
Pic.ScreenLoad ("Lime Chicken.jpg", 361, 182, picCopy)
Pic.ScreenLoad ("SweetnSourchicken.jpg", 22, 22, picCopy)
Pic.ScreenLoad ("SpicyChicken.jpg", 358, 22, picCopy)
fontPapyrus := Font.New ("Papyrus:30:italic")
Font.Draw ("Click On An Image To See More", 20, 360, fontPapyrus, 1)
buttonwait ("down", x, y, buttonnumber, buttonupdown )
Font.Draw ("Menu", maxx - 75, 35, fontArial, 1)
drawbox (maxx - 25, 30, maxx - 85, 55, 1)
buttonwait ("down", x, y, buttonnumber, buttonupdown )
if (x < 15 and x > 214 and y < 181 and y > 349) then % OVER HERE! <----- HERE IS MY PROBLEM!!!
cls
Pic.ScreenLoad ("Chic.jpg", 21, 227, picCopy)
Font.Draw ("Buffalo Style", 255, 362, fontArial1, 1)
Font.Draw ("These are the best chicken wings you will ever find", 255, 338, fontArial, 1)
Font.Draw ("Juicy and rich with texture. You can't resist these wings", 255, 321, fontArial, 1)
Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, 1)
Font.Draw ("anywhere else.", 255, 287, fontArial, 1)
Font.Draw (" Price: $10.99", 255, 253, fontArial, 1)
end if
%----------------% INFO PAGES %--------------------%
%--------------------% BUFFALO INFO %---------------------------%
% cls
% Pic.ScreenLoad ("Chic.jpg", 21, 227, picCopy)
% Font.Draw ("Buffalo Style", 255, 362, fontArial1, 1)
% Font.Draw ("These are the best chicken wings you will ever find", 255, 338, fontArial, 1)
% Font.Draw ("Juicy and rich with texture. You can't resist these wings", 255, 321, fontArial, 1)
% Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, 1)
% Font.Draw ("anywhere else.", 255, 287, fontArial, 1)
% Font.Draw (" Price: $10.99", 255, 253, fontArial, 1)
%---------------------% LEMON CHICKEN %----------------------------%
% delay (5000)
% cls
% Pic.ScreenLoad ("Lime Chicken.jpg", 21, 227, picCopy)
% Font.Draw ("Lime Chicken", 275, 362, fontArial1, 1)
% Font.Draw ("These are the best chicken wings you will ever ", 275, 338, fontArial, 1)
% Font.Draw ("find. Juicy and rich with texture. You can't resist ", 275, 321, fontArial, 1)
% Font.Draw ("these wings. All for the cheap and low price. ", 275, 304, fontArial, 1)
% Font.Draw ("You will not find these anywhere else. ", 275, 287, fontArial, 1)
% Font.Draw ("Price: $8.99" ,275,260, fontArial,1)
%---------------------% SWEET N'SOUR CHICKEN %-------------------------%
% delay (5000)
% cls
% Pic.ScreenLoad ("SweetnSourchicken.jpg", 21, 227, picCopy)
% Font.Draw ("Sweet n' Sour Chicken", 255, 362, fontArial1, 1)
% Font.Draw ("These are the best chicken wings you will ever find", 255, 338, fontArial, 1)
% Font.Draw ("Juicy and rich with texture. You can't resist these wings", 255, 321, fontArial, 1)
% Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, 1)
% Font.Draw ("anywhere else.", 255, 287, fontArial, 1)
% Font.Draw (" Price: $11.99", 255, 253, fontArial, 1)
%----------------------% SPICY CHICKEN %---------------------------%
% delay (5000)
% cls
% Pic.ScreenLoad ("SpicyChicken.jpg", 21, 227, picCopy)
% Font.Draw ("Spicy Chicken", 255, 362, fontArial1, 1)
% Font.Draw ("These are the best chicken wings you will ever find", 255, 338, fontArial, 1)
% Font.Draw ("Juicy and rich with texture. You can't resist these wings", 255, 321, fontArial, 1)
% Font.Draw ("All for the cheap and low price. You will not find these", 255, 304, fontArial, 1)
% Font.Draw ("anywhere else.", 255, 287, fontArial, 1)
% Font.Draw (" Price: $8.00", 255, 253, fontArial, 1)
|
Ok. So in the code it show where the problem is. I made a button using "buttonwait" and I would really like to keep it at that. So you braniacs out there,... keep
it simple . Anyways, I made coordinates so that if you click on the picture it goes to the if statement and does the if statement. My problem is,
it doesn't. So please tell me.. WHAT IS THE PROBLEM!!! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
syntax_error
|
Posted: Mon Jan 05, 2009 6:49 pm Post subject: RE:Another Button Problem :( |
|
|
(x < 15 and x > 214 and y < 181 and y > 349)
how can x be less then 15 and greater then 214?
same thing for y its less then 181 yet greater then 349?
Trace through your code.
It helps. |
|
|
|
|
|
Sam_sam
|
Posted: Mon Jan 05, 2009 6:53 pm Post subject: RE:Another Button Problem :( |
|
|
WOW! I now understand the meaning of computer science. Thank you sytax_error, you fixed my problemo! Gracias.. or however you spell it! |
|
|
|
|
|
Sam_sam
|
Posted: Mon Jan 05, 2009 8:10 pm Post subject: RE:Another Button Problem :( |
|
|
How can I import music like a mp3 file so that it plays? |
|
|
|
|
|
Laplace's Demon
|
Posted: Mon Jan 05, 2009 8:14 pm Post subject: Re: Another Button Problem :( |
|
|
Before you hit this forum try searching through the turing reference. It is an incredibly powerful tool.
Just search "music" in turing reference.
It can be done in one very simple and easy step. |
|
|
|
|
|
Sam_sam
|
Posted: Mon Jan 05, 2009 8:36 pm Post subject: RE:Another Button Problem :( |
|
|
I KNOW! But, what I want to know is whether I am suppose to use the location of that file or am I suppose to JUST use the name? |
|
|
|
|
|
Laplace's Demon
|
Posted: Mon Jan 05, 2009 8:50 pm Post subject: Re: Another Button Problem :( |
|
|
If the music file is in the same directory (folder) as your program then just use the file name (ie. "song.MP3"). However if the file is in a different folder than your program you must specify that. For example if the music is in a sub-folder within the folder your game is housed in called the "music" folder then you would reference the file by calling "music/song.MP3". |
|
|
|
|
|
andrew.
|
Posted: Mon Jan 05, 2009 10:17 pm Post subject: RE:Another Button Problem :( |
|
|
Use Music.PlayFile to play music. Like Laplace's Demon said, if the music file is in the same folder as your Turing file (.t) then just use Music.PlayFile ("song.mp3"). If you have the music somewhere else like in a folder in your Turing folder then use Music.PlayFile ("My Folder/song.mp3"). |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|