Im having problems with putting spirites in my porgram i need help! 
	 
	
		| Author | 
		Message | 
	 
		 
		Timbit
 
  
 
    
		 | 
		
		
			
				  Posted: Fri Jan 07, 2011 12:59 pm    Post subject: Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Ok soo im having trouble creating a pacman game for my Culminating and i really need the marks so i can pass...
 
 
Here is my Program sorry if its a mess i really dont know what im doing so its a huge mess:
 
----------------------------------------------------------------------------------------------------------------------------------------------------
 
 
 
View.Set ("offscreenonly")
 
var font := Font.New ("serif:30")
 
drawfillbox (0, 0, maxx, maxy, blue)
 
Draw.Text ("Super Pacman!", 225, 225, font, yellow)
 
var picID: int
 
var ch : string (1)
 
getch (ch)
 
drawfillbox (0, 0, maxx, maxy, white)
 
var spriteID:int
 
cls
 
drawfillbox (0, 0, maxx, maxy, white)
 
var key, num : array char of boolean
 
var x, y : int
 
var pacstate : boolean
 
x := 120
 
y := 120
 
pacstate := true
 
var direction : boolean
 
var pics : array 1 .. numFrames of int
 
var delayTime : int
 
var pic1 : int := Pic.FileNew ("1up Mushroom.bmp")
 
Pic.ScreenLoad ("1up Mushroom.bmp", 20, 20, picCopy)
 
var pic2 : int := Pic.FileNew ("Mario Mushroom.bmp")
 
for w : 100 .. maxx - 100
 
    cls
 
    Pic.Draw (pic1, w, 50, picMerge)
 
    Pic.SetTransparentColor (pic1, grey)
 
 
    for i : 30 .. 625 by 20
 
    end for
 
end for
 
var sprite : int
 
sprite := Sprite.New (pic1)
 
Sprite.SetPosition (sprite, 0, 100, false)
 
Sprite.Show (sprite)
 
for w : 8 .. maxx by 8
 
    Sprite.Animate (sprite, pics ((x div 8) mod numFrames + 1), x, 100, false)
 
    delay (40)
 
end for
 
Sprite.Free (sprite)
 
var centered : boolean
 
 
loop
 
 
 
    for i : 30 .. 625 by 20
 
        drawfilloval (i, 50, 3, 3, yellow)
 
    end for
 
    Input.KeyDown (key)
 
    if key (KEY_RIGHT_ARROW) then
 
        if pacstate = true then
 
            drawfilloval (x, y, 10, 10, yellow)
 
            x := x + 5
 
            pacstate := false
 
        else
 
            drawfilloval (x, y, 10, 10, yellow)
 
            drawfillarc (x, y, 10, 10, 310, 40, white)
 
            x := x + 5
 
            pacstate := true
 
        end if
 
 
    elsif key (KEY_LEFT_ARROW) then
 
        if pacstate = true then
 
            drawfilloval (x, y, 10, 10, yellow)
 
            x := x - 5
 
            pacstate := false
 
        else
 
            drawfilloval (x, y, 10, 10, yellow)
 
            drawfillarc (x, y, 10, 10, 130, 210, white)
 
            x := x - 5
 
            pacstate := true
 
        end if
 
    elsif key (KEY_DOWN_ARROW) then
 
        if pacstate = true then
 
            drawfilloval (x, y, 10, 10, yellow)
 
            y := y - 5
 
            pacstate := false
 
        else
 
            drawfilloval (x, y, 10, 10, yellow)
 
            drawfillarc (x, y, 10, 10, 230, 310, white)
 
            y := y - 5
 
            pacstate := true
 
        end if
 
    elsif key (KEY_UP_ARROW) then
 
        if pacstate = true then
 
            drawfilloval (x, y, 10, 10, yellow)
 
            y := y + 5
 
            pacstate := false
 
        else
 
            drawfilloval (x, y, 10, 10, yellow)
 
            drawfillarc (x, y, 10, 10, 70, 120, white)
 
            y := y + 5
 
            pacstate := true
 
        end if
 
    else
 
        drawfilloval (x, y, 10, 10, yellow)
 
    end if
 
    View.UpdateArea (x - 45, y - 45, x + 45, y + 45)
 
    drawfilloval (x, y, 45, 45, white)
 
    delay (120)
 
    %Border
 
    drawfillbox (0, 0, 20, 420, 9)
 
    drawfillbox (20, 420, 620, 380, 9)
 
    drawfillbox (640, 400, 620, 20, 9)
 
    drawfillbox (640, 0, 20, 20, 9)
 
    drawfillbox (580, 70, 50, 80, 9)
 
    if key (KEY_DOWN_ARROW) and key (KEY_RIGHT_ARROW) then
 
        y := y - 5
 
        x := x + 5
 
    end if
 
 
    if key (KEY_UP_ARROW) and key (KEY_RIGHT_ARROW) then
 
        y := y + 5
 
        x := x + 5
 
    end if
 
    Pic.ScreenLoad ("Mario Mushroom.JPEG", 13, 10, picCopy)
 
end loop
 
_________________________________________________________________________________________________________
 
 
I told u it was horribly messy can anyone Help? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Fri Jan 07, 2011 2:27 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				There should have been a template that was asking you what you are having problem with, and to explain what you've tried so far to solve those problems.
 
 
This is a lot of code. People don't like looking at a lot of code. You should clean it up.
 
 
Right now it looks like there were random things thrown in, that don't do anything useful.
 
	  | code: | 	 		  
 
var ch : string (1) 
 
getch (ch)
 
  | 	  
 
	  | code: | 	 		  
 
drawfillbox (0, 0, maxx, maxy, white) 
 
var spriteID:int 
 
cls 
 
drawfillbox (0, 0, maxx, maxy, white)
 
  | 	  
 
Oh yeah, none of that is in any loops. Then there are empty loops.
 
	  | code: | 	 		  
 
for i : 30 .. 625 by 20 
 
end for 
 
  | 	 
  | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Timbit
 
  
 
    
		 | 
		
		
			
				  Posted: Fri Jan 07, 2011 2:46 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i put the spirites in there cuz i was trying to get the mushroom too move   | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Timbit
 
  
 
    
		 | 
		
		
			
				  Posted: Wed Jan 12, 2011 2:21 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Ive gotten a bit farther but still need help with making barriers that pacman wont go through & still need to know how to creat the baddies
 
(*the ghosts*) | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Wed Jan 12, 2011 2:52 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				If you are familiar with arrays, a common approach is to use tiles to both draw the map and act as barriers. Alternatively you can use lots and lots of if statements, but that's redundant and very easy to make mistakes with.
 
 
There are many places online that describe canon personalities of ghosts, but simply using Rand.Int to decide on a random direction is a good start. | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Timbit
 
  
 
    
		 | 
		
		
			
				  Posted: Fri Jan 14, 2011 12:29 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| This is my first year taking computer programing and all i have done is read from the book so im pretty new with this kind of stuff | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		 | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Timbit
 
  
 
    
		 | 
		
		
			
				  Posted: Mon Jan 17, 2011 12:28 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Ok so ive read the tutourial and dont realy get how to make the barricades with the arrays ill read over it again, plz i realy need help i only have 2 weeks left   | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Mon Jan 17, 2011 12:59 pm    Post subject: RE:Im having problems with putting spirites in my porgram i need help!  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| With arrays you could have a map of the field that you are playing on. Then it would be trivial to check if there's a barrier at some particular location of the map. | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |