The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.

ForumsProgramming Forumso im making a little flash game and cant get my music on it

28 13441
took95
offline
took95
438 posts
Nomad

i am making this game on flash cs5, i have the coding down for the gameplay, and i even have discovered how to get all sorts of things, BUT its silent. i want help with this, i cant find any good places to getmusic for games, as a matter of a fact, i cant find ANY. either way here is a link to the swf. file if you just want to check it out and see my progress:

and here is the flash file if you want to tweak it and change it how you want:


i want to get a couple of songs up with this, i was thinking ofputting some music from my mp3 player or musin library and neither work, if you can help me with this, i would settle with a site for getting music. Also, if this changes anything(and i think it does) my default music playeris VLC media player, but i have windows media player also, the music DOES work, i have tried converting songs to files that are compatible with flash, but with all my research and messing with stuff, i cant find out what to do....please help me, the best way to contact me, thats not thru AG(which i am sad to say i cant always get to) is at my hotmail, tristan.alexander@hotmail.com
if you have advice about how i should do something or change something email me.

(also this isnt a game for AG, not yet:P, but i am turning it in for a "talent show" for my online school(insight) flash animation class because i did the entire years work in 3 days, and wanted to make games. So keep that in mind when you look over this.)

PS. I dont care what you do with this, as i said this is my class assignment, it is DEFINATELY a begginer game, but if you change stuff, or share it, or even say YOU made it, I dont care, just help me with the music please.

PSS. i was putting in teleporters with the "restart" format, the coding that maks it so when you touch a point, you are sent to another, so if there is hanging code anywhere that is why.

PSSS. just for your info, these are the codes i used, i have them all copied down on text documents:

FOR CHARACTER "GRAVITY"

onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;
var speed:Number = 15;
var maxJump:Number = -20;
var touchingGround:Boolean = false;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}
if (ground.hitTest(_x, _y+5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.UP) && touchingGround) {
grav = maxJump;
}
if (ground.hitTest(_x+(_width/2), _y-(_height/2), true)) {
_x -= speed;
}
if (ground.hitTest(_x-(_width/2), _y-(_height/2), true)) {
_x += speed;
}
if (ground.hitTest(_x, _y-(height), true)) {
grav = 3;
}
}

FOR THE VIRTUAL CAMERA(VCAM)

onClipEvent (enterFrame) {
_y += (_root.char._y-_y)/4;
_x += (_root.char._x-_x)/4;
}


FOR THE RETURN TO A POINT

onClipEvent (enterFrame) {
if (_root.char.hitTest(this)) {
_root.char._x = charX
_root.char._y = charY
}
}

FOR MAKING THE HP TIMELINE PROGRESS(DAMAGE)

onClipEvent(enterFrame) {
if(_root.char.hitTest(this)) {
_root.vcam.hp.nextFrame();
}
}

THE "PLAY AGAIN?" BUTTON

on(release) {
_root.gotoAndStop("game"
}


WHEN HP REACHES FINAL FRAME GAMEOVER IS TRIGGERED

_root.gotoAndStop("gameover"


ALSO I WOULD REALLY LIKE TO HAVE MULTIPLE LEVELS, IF SOMEONE CAN HELPME WITH THAT I WOULD BE VERY GRATEFUL
  • 28 Replies
took95
offline
took95
438 posts
Nomad

ooops, i never put the adress for the flash file, sorry, here it is:

took95
offline
took95
438 posts
Nomad

also, this game has a LONG time left, but i will be turning it in by friday(17th) and this is just the part where i am at now, i was tired of a quiet screen. all i had was my thoughts....(and the voices :P, jk) so i was going to add music, i WAS going to do this later, but it got bumped up, and couldn't....either way, HELP NEEDED

took95
offline
took95
438 posts
Nomad

ok so i turned in the assignment and finished off the years work, but i still have silent games, please help, i know this could be considered "reviving" a dead thread, but i just refound the thread and i still need help,someone please help out and explain howto put music in, i have tried google and it is to vague or to speciffic to a certain case, please a quick little tutorial would be awesome, i catch on fast, and once i do it i can figure out little tricks realted to it but i need help.

darkelmo1
offline
darkelmo1
4 posts
Nomad

what is the name of this game?

GeraldGefter
offline
GeraldGefter
24 posts
Nomad

You should insert your vaw or mp3 to libraly then you can use some codes or if you want just place it somewhere in timeline
there should me in frame properities sound editing

GeraldGefter
offline
GeraldGefter
24 posts
Nomad

and file can be opened only with CS5?
ha-ha
by the way you can load music without adding it to libraly
I see that you are using Cs2(or I'am wrong?)
var music01:Sound = new Sound(); //simly make new object - sound
music01.loadSound("music.mp3", true); //just load file what you got near your swf(if it is somwhere else you should write path to it or web adress)
dont want to hear that music delete this object

took95
offline
took95
438 posts
Nomad

i am using Cs5, and i was just trying to import a song and it wouldnt work, the name, i believe i am going with, is the adventure, and as i said this is a school project, this class is ending, but luckily i have flash next semester also, i like being able to make games, im WAY ahead of most of my class apparently, and i wanted music, which i believe isnt being covered, ill try out that well not if it is only for cs2, the 2 i was referring to was ActioScript 2.0 on my flash cs5, this isnt nearly as urgent anymore, yet.
this game is NOT AG material, but i will be making some that i hope to eventually upload to here? anyone know any requirements i should know? any suggestions of games, really at this point i am open to anything about it, i am catching on fast, and kind of hit a wall at what i can do by myself, im not that creative, but i feel i can make a game...my second semester starts up feb. 1st, so at that point i will proly have more questions, and one last thing...:
is there any format i should have my music, i looked up that basically, it needs to be mp3, and all my music is, so are there anymore formats i should try??

beech
offline
beech
107 posts
Nomad

Flash will also support .wav and even .aiff files in addition to .mp3 - mp3 will often produce the best sounds quality for the least amount of memory space

gaboloth
offline
gaboloth
1,612 posts
Peasant

Maybe it's just my dumb as2-ness, but how about importing the file in the library and dragging it to the scene? It worked for me.
(just for the background music, I mean.)

beech
offline
beech
107 posts
Nomad

LOL - not at all - one can certainly place a sound on the timeline and there is nothing wrong with that - but this does work better if it's an animation project or something that will simply 'run' because you give up some control over the instance when placed on the stage rather than implementing it with code

took95
offline
took95
438 posts
Nomad

so its a platform game so i would want to use more coding then?? like what, would GeraldGefter's suggested code work? i couldnt get anything, i got errors. so what should i do, i need this for my class/game anything helps, and i glad this is getting results now, this has been up forever

Hectichermit
offline
Hectichermit
1,828 posts
Bard

Well the best option would probably have to make some sorta music player in flash nothing to fancy just something to load music from your library and loop it, you can have it loop like 50 times then switch it. that is if your using loops if you have a full track then you will probably have to code the length of the songs and then have some sorta counter in your player to count down to zero and when it gets to zero you'll need to go to another song.

beech
offline
beech
107 posts
Nomad

yeah - that's pretty much right H - however you can also set a listener to the SOUND_COMPLETE event and then trigger the 'next' sound or loop the original - of course you can also loop a sound by including a 'large' number (like 9999) in the loop parameter of the start() method

now, you're using AS2 right - so the code that Gerald used there is close - however it is set up for a sound is external, in the example he gives, it would be located in the same file as your game. so, this will work if it's external.

but if it the sound is imported into the Library - then you need to use something a little different - in particular the attachSound() method and it's assigned linkage id - like so:

var sound:Sound = new Sound();
sound.attachSound( "soundID" );
sound.start(0,9999); //<- 2nd int is the loop parameter

now i'd mentioned the event listener earlier, but that is more of an AS3 ref - so in AS2 it's a little different and we call the onSoundComplete method on the instance - like so:

sound.onSoundComplete = function() {
//do stuff here when the sound is done
}

beech
offline
beech
107 posts
Nomad

note on the above: to set the linkage ID of the sounds instance in the Library, right-click the instance opening the properties panel - and type in whatever name you would like in the ... yep, you guessed it, the 'linkage id' field - lol

took95
offline
took95
438 posts
Nomad

thanks but how do i get it into the library beech?

so i was googling around for atutorial and i found this:P, i just saw "so i am making a little game and i cant get music on it" and i was like YES! but then i opened the link and saw it was this :P, but so i know how to play music, from MY computer using this code:
coolTune = new Sound (soundLoader);
coolTune.loadSound("songtitle.mp3", true);
but i cant get it so if i post my swf file somewhere(primarily my class) i get errors, and duh, they dont have the music in the same spot as me, so without the music it works fine, but if i add music it wont run, so i need a way to put music into the library and i cant get it... any ideas, importing doesnt work.. i get errors about how it cant be read? i found somewhere that i need to open it as an external library, but then i get an empty library named whatever the song was so..? sooo confused on this too

ALSO my one other prob in flash now, is that i cant get a scene to play when i press a button. i want my game to play the scene i called "right" or "left" when he walks right and left. i can get it to move left and right but it always stays in the "idle" position. then i eventually figured it out so that he will turn and walk, but he walks after i release the button, so it will turnleft and float left wheni press left, theni let go and he will stand teh stepping in place, this is because i have the code so that wheni press the button it plays the clip, but it plays it for every time i press the button, and im holdong it, but so i want it to be so that it will play it while i move, and stop when i stop, i couldnt get the keylistener to work well though so can someone explain that or help me come up with a code, so here is the code i was tweaking around(it is edited to work the way i want it to now...

onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;
var speed:Number = 8;
var maxJump:Number = -20;
var touchingGround:Boolean = false;
var right:Boolean = false;
var left:Boolean = false;
var walk:Boolean = false;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true))
{
_y -= gravity;
grav = 0;
}
if (ground.hitTest(_x, _y + 5, true))
{
touchingGround = true;
}
else
{
touchingGround = false;
}
//
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
if (Key.isDown(Key.RIGHT))
{
_x += speed;
gotoAndStop("right&quot;
}
if (Key.isDown(Key.LEFT))
{
_x -= speed;
gotoAndStop("left&quot;
}
//
//
//
if (Key.isDown(Key.UP) && touchingGround)
{
grav = maxJump;
}
if (ground.hitTest(_x + (_width / 2), _y - (_height / 2), true))
{
_x -= speed;
}
if (ground.hitTest(_x - (_width / 2), _y - (_height / 2), true))
{
_x += speed;
}
if (ground.hitTest(_x, _y - (height), true))
{
grav = 3;
}
}

btw, i havent been on i awhile so sorry AG! been grounded:P

Showing 1-15 of 28