Coordinates help?
Author |
Message |
kroh
|
Posted: Fri Jan 01, 2010 2:15 pm Post subject: Coordinates help? |
|
|
What is it you are trying to achieve?
Im making a game for myself, kind of like Duck Hunt
What is the problem you are having?
the part where I have to record that the target was hit
Describe what you have tried to solve this problem
I tried by making something like the code below and I don't understand how to make it so that if I shoot inbetween two coordinates, the counter will mark that a target was hit. I've declared x and y and all that but I just can't get it to make it count when hit in certain areas. When I run the program below, it says: Syntax error at ','. expected ')'
I know what it means, so yeah how would I write it so that it says "If you shoot inbetween coordinate 1 and coordinate 2, counter goes up"?
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
if x = (60, 135) and y = (220, 320) then
c := c + 1
else
c := c
end if
|
Please specify what version of Turing you are using
I'm using Turing 4.1.1
help would be gladly accepted |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheGuardian001
|
Posted: Fri Jan 01, 2010 3:49 pm Post subject: Re: Coordinates help? |
|
|
that would be the purpose of the > and < signs.
> is greater than
< is less than.
they can also be combined with the equal sign, as >= and <=, which are greater than or equal to, and less than or equal to, respectively.
code: |
var x : int := 20
var y : int := 75
var z : int := 37
put x > y %will output false
put y > z %will output true
% if all conditions are met:
%x is greater than or equal to 15 AND less than or equal to 30
%in other words, between 15 and 30
if (x >= 15 and x <= 30) then
put "hooray!."
|
|
|
|
|
|
|
kroh
|
Posted: Fri Jan 01, 2010 6:08 pm Post subject: RE:Coordinates help? |
|
|
oyeah.... wow i feel pretty dumb. Thanks a lot though |
|
|
|
|
|
|
|