Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Asterisk bouncing!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Big_Botty_Bellydancer




PostPosted: Thu Jan 13, 2005 9:23 am   Post subject: Asterisk bouncing!!!

Hey, I am trying to make my asterisk bounce on my turing page. I managed to make it move all over the page, however, it is not bouncing. Here is what I have so far, plz help!!!
Crying or Very sad

colour (12)
process playstuff
loop
play ("decfgfegdcabcgdefgabcdggfabedcabdefgcdabgdefg")
delay (500)
play ("cdefgabcgabcdfgeabdegfdeebacfgcdefgabcdefgabc")
delay (500)
end loop
end playstuff

fork playstuff %fork it to play music

% This is a program that lets you use the arrow keys to control the blocker.%
% The object is to block ten asterisks.%

const BLOCKER:=
chr(220)+chr(220)+chr(220)+chr(220)+chr(220)
const WAIT:=125
const NUMBER_OF_ASTERISKS:=10
const LEFT_ARROW:=chr(203)
const RIGHT_ARROW:=chr(205)
const HOME:=chr(199)
const END:=chr(207)
const BLOCKER_ROW:=24
const BLANK_BLOCKER:=" "

var Key: string(1)
var Asterisk_Column, Start, Finish: int
var Blocker_Column:=38
var Asterisk_Row:=2

setscreen ("noecho,nocursor")


procedure Move_Blocker
%We wait for the user to press a key.
getch (Key)

%We erase a previously positioned blocker.
locate(BLOCKER_ROW, Blocker_Column)
put BLANK_BLOCKER

%We adjust the position of the blocker
%according to the direction specified
%by the user.0
if Key=RIGHT_ARROW then
Blocker_Column:=Blocker_Column+2
elsif Key= LEFT_ARROW then
Blocker_Column :=Blocker_Column-2
elsif Key= HOME then
Blocker_Column :=2
elsif Key=END then
Blocker_Column :=75
end if

%We do not allow the blocker to be moved
%Beyond the borders of the screen

if Blocker_Column >75 then
Blocker_Column :=75
elsif Blocker_Column <2 then
Blocker_Column :=2
end if

%The blocker is displayed on the screen.

locate (BLOCKER_ROW, Blocker_Column)
put BLOCKER

end Move_Blocker

locate (BLOCKER_ROW, Blocker_Column)
put BLOCKER

randomize

clock (Start)

for Asterisk: 1..NUMBER_OF_ASTERISKS
locate (1,1)
put "Asterisk #", Asterisk
randint (Asterisk_Column,2,79)

loop
locate(Asterisk_Row, Asterisk_Column)
put "*"
delay (WAIT)

if hasch then
Move_Blocker
end if

locate (Asterisk_Row, Asterisk_Column)
put " "

Asterisk_Row:= Asterisk_Row+1

if Asterisk_Row>24 then
Asterisk_Row:=2
end if

if Asterisk_Column>=Blocker_Column and
Asterisk_Column<=Blocker_Column+4 and
Asterisk_Row=24 then
sound(1000,100)
exit
elsif Asterisk_Row = 24 and
(Asterisk_Column < Blocker_Column or
Asterisk_Column > Blocker_Column +4) then
sound (100,100)
end if

end loop
end for

clock (Finish)

cls
put "Time: ", (Finish-Start)/1000, " Seconds."
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Jan 13, 2005 9:40 am   Post subject: (No subject)

you guys are probably in the same class... so why dont you get together and figure out the common problems?

http://www.compsci.ca/v2/viewtopic.php?t=7220
http://www.compsci.ca/v2/viewtopic.php?t=7304
Amreen




PostPosted: Fri Jan 14, 2005 3:26 am   Post subject: (No subject)

don't u think we've tried it...thats why we are asking for ur help and suggestions. Very Happy
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: