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

Username:   Password: 
 RegisterRegister   
 Working on my game... fairly new to Turing... music help >
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Grogrog




PostPosted: Fri Nov 19, 2004 8:53 pm   Post subject: Working on my game... fairly new to Turing... music help >

Well, I am a grade 10 student in computer science this year, and I have found it very fun so far. I am way ahead of most of my class, there are two others who are very good too.

Right now I am working on a platformer - arena two player battle game. It's I guess sorta like that old Mario vs. game where you had to get 5 coins before the other player did.

Anyways, right now I am working on my title screen and it's going pretty well. I have the other part of the code in a seperate file and I am gonna merge them later.

Anyways, I don't know how to get the music to play. I don't know how to select the directory, or where the music should be. It's a midi file I want to put into my title screen. And for those who are interested here is my title screen so far:

code:

setscreen ("offscreenonly")
colorback (black)
color (brightblue)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Variables                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var pos : int := 214
var cursor : array char of boolean
var font : int := Font.New ("Comic Sans MS:20:Bold")
var font2 : int := Font.New ("Tahoma:11")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%End Variables                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Procedures                            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Draw
procedure draw
    delay (50)
    Draw.Box (10, 10, maxx - 10, maxy - 10, white)
    Draw.Box (9, 9, maxx - 9, maxy - 9, white)
    Draw.Box (8, 8, maxx - 8, maxy - 8, white)
    Draw.Box (7, 7, maxx - 7, maxy - 7, white)
    Draw.Box (1, 1, maxx - 2, maxy - 1, white)
    Draw.Oval (maxx div 2 + 60, pos, 4, 4, white)
    Draw.FillOval (maxx div 2 + 60, pos, 1, 1, brightcyan)
    Draw.Oval (maxx div 2 - 60, pos, 4, 4, white)
    Draw.FillOval (maxx div 2 - 60, pos, 1, 1, brightcyan)
    Draw.Line (maxx div 2 - 40, pos - 6, maxx div 2 + 40, pos - 6, white)
    Draw.Line (maxx div 2 - 40, pos + 8, maxx div 2 + 40, pos + 8, white)
    View.Update
end draw
%End Draw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%End Procedures                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
    delay (40)
    cls
    Draw.Text ("Head-to-Head", (maxx div 2) - 95, maxy div 2 + 55, font, brightcyan)
    Draw.Text ("Battle V0.1", (maxx div 2) - 92, maxy div 2 + 40, font2, grey)
    locate (maxrow div 2, maxcol div 2 - 4)
    color (brightblue)
    put "Two Player"
    locate (maxrow div 2 + 1, maxcol div 2 - 4)
    put "Practice"
    locate (maxrow div 2 + 2, maxcol div 2 - 4)
    put "Options"
    locate (maxrow div 2 + 3, maxcol div 2 - 4)
    put "High Score"
    %Cursor Colour
    if pos = 214 then
    color (brightcyan)
    locate (maxrow div 2, maxcol div 2 - 4)
    put "Two Player"   
    elsif pos = 214-16 then
    color (brightcyan)
    locate (maxrow div 2 +1, maxcol div 2 - 4)
    put "Practice"
    elsif pos =214-32 then
    color (brightcyan)
    locate (maxrow div 2 +2, maxcol div 2 - 4)
    put "Options"
    else
    color (brightcyan)
    locate (maxrow div 2 +3, maxcol div 2 - 4)
    put "High Score"
    end if
    Draw.Box ((maxx div 2) - 70, (maxy div 2) - 50, (maxx div 2) + 70, (maxy div 2) + 30, white)
    Draw.Box ((maxx div 2) - 71, (maxy div 2) - 51, (maxx div 2) + 71, (maxy div 2) + 31, white)
    draw   
    Input.KeyDown (cursor)
    if cursor (KEY_UP_ARROW) then
        if pos = 214 then
            pos := 166
        else
            pos := pos + 16
        end if
    else
    end if
    if cursor (KEY_DOWN_ARROW) then
        if pos = 166 then
            pos := 214
        else
            pos := pos - 16
        end if
    else
    end if
    if cursor (KEY_ENTER) then
        if pos = 214 then
        elsif pos = 214 - 16 then
        elsif pos = 214 - 32 then
        elsif pos = 214 - 48 then
        else
        end if
    else
    end if
end loop


I might be biting off more then I can chew but I plan on making this program through out the entire year until it is completely perfected. Please don't laugh if anything seems weird, or different, considering I made this in a day, and learned some new things while doing it.
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Fri Nov 19, 2004 9:07 pm   Post subject: (No subject)

Music.PlayFile ()

Press F10. It's the API, you'll enjoy it. Good luck.
Grogrog




PostPosted: Fri Nov 19, 2004 10:45 pm   Post subject: (No subject)

Uh. That doesn't do anything for me. I need real help. And I know about the help file. Like I've said I've tried stuff.

Edit: Awsome.

I sorta figured out how to get it to work. Well, I always knew how... but I just don't know how to point the directory to where the music file is.
And how would I make it so that if somebody downloaded my game they could hear the music...

Right now it looks like this: (I edited the example file in Turing help)
code:

process DoMusic
    loop
        Music.PlayFile ("%oot/support/help/Examples/Data Files/character_setup.mid")
    end loop
    end DoMusic
    fork DoMusic
Mr. Glib




PostPosted: Sat Nov 20, 2004 4:42 pm   Post subject: (No subject)

Try keeping your source codes and music files in the same directory.
Delos




PostPosted: Sun Nov 21, 2004 12:18 am   Post subject: (No subject)

Also, if you're running 4.0.5 then look up the following commands:

Music.PlayFileLoop()
Music.PlayFileReturn()
Music.PlayFileStop()
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  [ 5 Posts ]
Jump to:   


Style:  
Search: