| Moving A Picture 
 
	 
	
		| Author | Message |   
		| Preet 
 
 
 
 
 | 
			
				|  Posted: Fri Nov 30, 2007 9:14 am    Post subject: Moving A Picture |  |   
				| 
 |  
				| I just wanted to know how would i make a picture bounce, because my game is suppose to be like im suppose to make a ball bounce and your suppose to dodge it. But i cant make the picture bounce. this is the code so far. Can someone please correct it and re-post it again. 
 
 setscreen ("graphics:1000;600")
 drawfillbox (1000, 800, 1000, 800, black)
 var numFrames := Pic.Frames ("H:/happy_face_clears.gif")
 % Load the picture
 var delayTime : int
 var pics : array 1 .. numFrames of int
 Pic.FileNewFrames ("H:/happy_face_clears.gif", pics, delayTime)
 
 var sprite, move : int
 
 
 sprite := Sprite.New (pics (1))
 Sprite.SetPosition (sprite, 0, 0, false)
 Sprite.Show (sprite)
 loop
 for x : 2 .. 1350
 if x > 600
 then
 move := -610
 if x > 0
 then
 move := -610
 Sprite.Animate (sprite, pics ((x div 8) mod numFrames + 1), x + move, 0, false)
 delay (5) % Stop sprite from moving too quickly
 else
 move := -610
 Sprite.Animate (sprite, pics ((x div 8) mod numFrames + 1), x + move, 0, false)
 delay (5) % Stop sprite from moving too quickly
 end if
 end if
 end for
 end loop
 
 Sprite.Free (sprite)
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Zampano 
 
  
 
 
 | 
			
				|  Posted: Fri Nov 30, 2007 10:04 am    Post subject: Re: Moving A Picture |  |   
				| 
 |  
				| I never had luck using Sprites, so I'm not sure if would work for you either. But about your problem; the way yoiu make things travel in a parabola is to have an x increment and a y increment that is added to y each time through the loop. In turn, the yinc decreases by a set amount each time, so that each time, less and less is added to the y until the yinc is a negative number (making the y decrease: the bouncing object is falling). When the object reaches 0, restore yinc to an amount which will cause the y to go up (bounce off of the ground).
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Preet 
 
 
 
 
 | 
			
				|  Posted: Fri Nov 30, 2007 3:00 pm    Post subject: Moving A Picture |  |   
				| 
 |  
				| I tried everything even my teacher cant figure it out. LOL... so i just thought some else could help. So please someone post it before monday because i have to add the keyboard movements also. 
 Thanks!!!
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |