Music in background for my game
Author |
Message |
Blackfire
|
Posted: Fri May 08, 2009 9:51 am Post subject: Music in background for my game |
|
|
What is the problem you are having?
Getting music in the background
The file is called CG.MIDI
Its in
H:\My Documents\TIK201\PaddleBall
All i know is Music.PlayFileLoop ("CG.MIDI")
is this the right way and where would it go, if it inst right, what is the right way and where would it go?
Turing: |
%*************************************%
% Ryan Moore %
% PaddleBall game %
%"You must hit the ball on the paddle"%
% "Beat the high score" %
%*************************************%
%
var hitpoint : int
var yn : string
% BALL
var x : int
var xdir : int
var y : int
var ydir : int
% Paddle
var x2 : int
var key : string (1) % The key
var num : int % hold the ASCII number key
var x3 : int % x
loop
cls
x2 := 100
hitpoint:= 0
num := 0
x := 50
y := 330
xdir := 5
ydir := 5
View.Update
Pic.ScreenLoad ("PB.BMP", 400, 15, picCopy)
% Outside Border/ Inside Border
%Inside Red Border
drawbox (10, 10, 320, 399, 12)
drawbox (19, 18, 311, 391, 12)
drawfill (15, 15, 12, 12)
% Red Border for Score
drawbox (410, 170, 610, 390, 12)
drawbox (400, 160, 620, 400, 12)
drawfill (405, 165, 12, 12)
% Red border for Icon
drawbox (405, 100, 615, 20, 12)
drawbox (390, 0, 630, 110, 12)
drawfill (400, 10, 12, 12)
% Outside Black
drawfill (340, 240, 7, 12)
loop
drawfillbox (x2, 20, x2 + 50, 30, 17) % Paddle
drawfilloval (x, y, 10, 10, 27) % draw the ball
exit when y < 30
View.Update
delay (10)
drawfilloval (x, y, 10, 10, 0) % erase the ball
drawfillbox (x2, 20, x2 + 50, 30, 0) % Erase paddle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if hasch then % if a key has been pressed
getch (key ) % get the key
num := ord (key ) % get the key's ASCII code
end if
if num = 203 and x2 > 25 then % if pressed left arrow key
x2 := x2 - 20
elsif num = 205 and x2 + 50 < 305 then % if pressed right arrow key
x2 := x2 + 20
end if
num := 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if x >= 300 then % if hit right side
xdir := - 3 % change direction to go left (negative)
elsif x <= 30 then % if hit left side
xdir := 3 % change direction to go right (positive)
end if
if y >= 380 then % if hit top side
ydir := - 3 % change direction to go down (negative)
elsif y <= 40 and x >= x2 and x <= x2 + 50 and y > 30 then % if hit bottom side
ydir := 3 % change direction to go up (positive)
locate ( 4, 70)
put ("score")..
hitpoint: = hitpoint + 1
locate (5, 70)
put hitpoint ..
end if
% actually moves the ball
x := x + xdir
y := y + ydir
end loop
View.Set ("nooffscreenonly")
locate (1, 1)
put "Do you want to play again? (y/n)"
get yn
exit when yn = "n"
end loop
|
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Kharybdis

|
Posted: Fri May 08, 2009 10:49 am Post subject: RE:Music in background for my game |
|
|
Look up the 'fork' command. |
|
|
|
|
 |
Dusk Eagle

|
Posted: Fri May 08, 2009 2:26 pm Post subject: Re: Music in background for my game |
|
|
Yes, this is the one time it's ok to use processes in Turing. For all other activities, it is shunned upon, but for music it works just fine. You'll also need to look up the Music module. |
|
|
|
|
 |
|
|