Sound effects in mario 
	 
	
		| Author | 
		Message | 
	 
		 
		God
 
  
 
    
		 | 
		
		 | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		Homer_simpson
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 3:51 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				you know when those sorta things happen to me i declare a boolean, check this to see what i mean
 
 
	  | code: | 	 		  var play_coin:boolean:=false
 
 
loop
 
%blah blah
 
%blah blah
 
%blah blah
 
 
if supposed to play the sound effect then 
 
play_coin:=true
 
end if
 
 
%blah blah
 
%blah blah
 
%blah blah
 
if play_coin then
 
play("coin sound effect.wav")
 
play_coin:=false
 
end if
 
%blah blah
 
%blah blah
 
%blah blah
 
end loop  | 	  
 
 
This usually solves my problem i dunno if it'll work for u or not... =/ | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		hello
 
 
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 3:56 pm    Post subject: hello  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				when u play the music u should have a checking statement that if u are in the coin u play the music
 
and then another if that when u are not in the coin u play another music | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Homer_simpson
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 4:08 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				isn't that just what i said??!!           | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		God
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 4:33 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I got the sound working and the coin dissappears and so on now.... but i tried it with multiple coins and when i hit one they all dissappear.....
 
hmm....
 
 
 
Quote: var hit : boolean := false
 
procedure coin (position, height : int)
 
    if c > 8 then
 
        c := 1
 
    end if
 
    coinx := maxx - coinpos + position - mariox
 
    coiny := height
 
    coinradius := Pic.Width (Coin (c))
 
    if mariox + mariowidth > coinx and mariox < coinx + coinradius and marioy + marioheight > coiny and marioy < coiny + coinradius then
 
        if hit = false then
 
            fork PlaySound (CoinSound)
 
            Pic.Draw (Coin (0), coinx, coiny, picMerge)
 
        end if
 
        hit := true
 
    elsif hit = false then
 
        if backx <= maxx - position then
 
            Pic.Draw (Coin (c), coinx, coiny, picMerge)
 
        end if
 
    end if
 
 
end coin 
 
 
 
 
Any help is much appreciated Coin(0) is a blank coin to make it dissappear...
 
 
Quote: %draw procedure...
 
    Pic.Draw (background, backx, backy, picCopy)
 
    c += 1
 
    coin (600, 200)
 
    coin (750, 200)
 
    Pic.Draw (marioBig (p), mariox, marioy, picMerge)
 
    View.Update  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Homer_simpson
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 4:36 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| process and fork stuff always confuses me that why i always use procedure and functions so sorry cant help with that but i could rewrite the whole code if u want... | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Homer_simpson
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 4:40 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				but i can suggest one thing:
 
	  | code: | 	 		  
 
type acoin:record
 
x,y:int
 
visibile:boolean
 
end record
 
var coins:array 1..10 of acoin
 
 
procedure draw
 
 
for i:1..10
 
if coins(i).visible then 
 
Pic.Draw (coin,x,y, picCopy) 
 
end if
 
end for
 
 
end draw  | 	  
 
 
and everytime u want a coin to disappear simply make the coins(number).visible:=false | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		hello
 
 
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 4:45 pm    Post subject: apology  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				sorry
 
i cant read
 
...   
 
 
well for the new prob u should have have each individual coin as a proc or fork or watever
 
and have it like this:
 
 
var x,y:array 1.. (num of coins) of int
 
 
fork coin(coinx,coiny:int)
 
 
so each coin has its own x and y value
 
 
then within the fork have the x and y value set it to an global variable
 
like:
 
 
x(_):=coinx
 
y(_):=coiny
 
 
after just check using ifs in a for loop
 
so its quicker
 
try it though but ijm not sure that im rite | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		God
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 11, 2003 8:03 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| hmm, i'd never used records before now... i was also trying to write it so i could call the procedure to make multiple coins repeatedly, but from the sounds of it this will work better... thanks... but keep watching the topic i dont doubt ill have many more problems soon | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |