The coins just don't come back
Author |
Message |
TheBboy
|
Posted: Mon Dec 24, 2012 5:55 am Post subject: The coins just don't come back |
|
|
What is it you are trying to achieve?[/size
When ever someone shoots on this program the gold(yellow oval) never come back, if it does only one of them come back. I want all three to come back
[size=14]Describe what you have tried to solve this problem
I try to do whatdotcolor with a loop but didn't work
Turing: |
var x, y, x1, y1 : int := 40
var key : array char of boolean
procedure hi
loop
Input.KeyDown (key )
if key (KEY_TAB ) then %shooting
for g : 1 .. 60
drawfilloval (x1, y1, 5, 5, purple)
delay (10)
drawfilloval (x1, y1, 5, 5, white)
x1 := x1 + 5
drawfilloval (x, y, 10, 10, black) %keeps the object on screen when while shooting
end for
drawfilloval (x, y, 10, 10, white) %removes the black left overs of the user decides to move around while shooting
x1 := x %ray goes back to the position where it got shoot from or to the object
end if
%
if key (KEY_UP_ARROW) then %up arrow
y := y + 10
y1 := y1 + 10
end if
if key (KEY_DOWN_ARROW) then %down arrow
y := y - 10
y1 := y1 - 10
end if
if key (KEY_LEFT_ARROW) then %left arrow
x := x - 10
x1 := x1 - 10
end if
if key (KEY_RIGHT_ARROW) then %right arrow
x := x + 10
x1 := x1 + 10
end if
drawfilloval (x, y, 10, 10, black) %object
delay (50)
drawfilloval (x, y, 10, 10, white) %clears the screen so it seems that the 'object' is moving
end loop
end hi
process j
var m, n : int := 200
for i : 1 .. 3
drawfilloval (m, n, 5, 5, yellow)
m := m + 20
end for
loop
if whatdotcolor (m, n ) = purple then
delay (50)
drawfilloval (m, n, 5, 5, yellow)
end if
end loop
end j
fork j
hi
|
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
vahnx
|
Posted: Wed Jan 02, 2013 5:04 pm Post subject: RE:The coins just don\'t come back |
|
|
I'd start by getting rid of processes. Move the contents of your process inside your main loop. |
|
|
|
|
 |
Raknarg

|
Posted: Wed Jan 02, 2013 9:46 pm Post subject: RE:The coins just don\'t come back |
|
|
Or change it to a procedure |
|
|
|
|
 |
|
|