Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 06-29-2009, 09:32 AM   #1 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Question Brickwall Game [Help]

Hi all,
Last week I followed a guide online to write a Brickwall game. The problem is, the ball will not knock out the bricks, but it should. I did not import the program, but wrote out each line as I saw it, with what I think the only changes being the actual message when the game is over, whether the user wins or not. The game starts off with red bricks, and that is where the problem is, although I don't know if the problem is with yellow/and/or green bricks, since I can't get to that point in the game itself. I have attached the code for it to be looked over to see any things with the code that looks out of place for this problem to occur.
Thanks, Jason



Code:
'paddle = GraphicsWindow.AddRectangle(120,  12) 'v0.2
paddle = Shapes.AddRectangle(120, 12) 'v0.3.1
'ball = GraphicsWindow.AddEllipse(16,  16) 'v0.2
ball = Shapes.AddEllipse(16, 16) 'v.0.3.1
bricksLeft = 48
brickStartY = 35
hitcount = 0
GraphicsWindow.FontSize = 14
GraphicsWindow.MouseMove = OnMouseMove
GraphicsWindow.Title = "Brickwall Game"
For idx = 0 To 15
  Array.SetValue("Green Bricks", idx, 1)
  Array.SetValue("Yellow Bricks", idx, 1)
  Array.SetValue("Red Bricks", idx, 1)
EndFor
DrawBricks()
score = 0
PrintScore()
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
y = gh - 28
'GraphicsWindow.MoveShape(ball, x, y) 'v0.2
Shapes.Move(ball,x,y) 'v0.3.1
deltaX = 1
deltaY = -2
Sound.PlayBellRingAndWait()
RunLoop:
x = x + deltaX
y = y + deltaY
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
If (x >= gw - 16 Or x <= 0) Then
  deltaX = -deltaX
EndIf
  If (y <= 0) Then
    deltaY = -deltaY
  EndIf
  
  'padX = GraphicsWindow.GetLeftOfShape(paddle) 'v0.2
  padX = Shapes.GetLeft(paddle) 'v.0.3.1
  If ((y >= gh - 28 + 2) And x >= padX And x <= padX + 120) Then
    y = gh - 28 + 2
    'Sound.PlayClick()
    hitcount = hitcount + 1
    If Math.Remainder(hitcount, 3) = 0 Then 'Move brick downwards
      For idx = 0 To 15
        RemoveGreenBrick()
        RemoveYellowBrick()
        RemoveRedBrick()
      Endfor
      brickStartY = brickStartY + 20
      DrawBricks()
    EndIf
    TestRed:
    For idx = 0 To 15
      If Array.GetValue("RedBricks", idx) = 1 Then
        If brickStartY > gh - 160 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    TestYellow:
    For idx = 0 To 15
      If Array.GetValue("YellowBricks", idx) = 1 Then
        If brickStartY > gh - 100 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    TestGreen:
    For idx = 0 To 15
      If Array.GetValue("GreenBricks", idx) = 1 Then
        If brickStartY > gh - 40 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    EndTest:
    
    deltaX = deltaX - 2 + (x -padX) / 30  ' Add some skill
    
    If score = oldScore Then  'No bricks hit
      score = score - 1
    EndIf
    oldScore = score
    PrintScore()
    deltaY = -deltaY 'Change the ball direction
  EndIf
  'GraphicsWindow.MoveShape(ball, x, y) 'v0.2
  Shapes.Move(ball,x,y) 'v0.3.1
  Program.Delay(5)
  
  'Green Bricks
  If y > brickStartY - 16 And y < brickstartY + 20 Then 'y position of brick - diameter of ball
    idx = (x+8) / 40 '  Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("GreenBricks", idx) = 1 Then
      Array.SetValue("GreenBricks", idx, 0)
      RemoveGreenBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY 'Change ball direction
      score = score + 15
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  
  'Yellow Bricks
  If y > brickStartY + 44 And y < brickStartY + 80 Then ' y position of brick - diameter of ball = 19
    idx = (x+8) / 40 'Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("YellowBricks", idx) = 1 Then
      Array.SetValue("YellowBricks", idx, 0)
      RemoveYellowBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY 'Change ball direction
      score = score + 10
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  
  'Red Bricks
  If y > brickStartY + 104 And y < brickStartY + 140 Then 'y position of brick - diameter of ball = 19
    idx = (x+8) / 40 'Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("RedBricks", idx) = 1 Then
      Array.SetValue("RedBricks", idx, 0)
      RemoveRedBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY ' Change ball direction
      score = score + 5
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  If (y < gh) Then 'Ball not reached bottom of window
    Goto RunLoop
  EndIf
  
  EndGame:
  GraphicsWindow.ShowMessage("Thanks, for playing Brickwall, and your score is : " + score, "Brickwall Game")
  Program.End()
  
  Sub OnMouseMove
    paddleX = GraphicsWindow.MouseX
    'GraphicsWindow.MoveShape(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.2
    Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.3.1
  EndSub
  
  Sub PrintScore
    ' Clear the score first and then draw the real score text
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(10, 10, 200, 20)
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.DrawText(10, 10, "Your score is: " + score)
  EndSub
  
  Sub DrawBricks
    For idx = 0 To 15 'Draw bricks
      'Program.Delay(100)
      If Array.GetValue("GreenBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Green"
        Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY, 40, 20)
      
      GraphicsWindow.BrushColor = "Yellow"
      If Array.GetValue("YellowBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Yellow"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20)
      
      GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.PenColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
    EndFor
  EndSub
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 06-30-2009, 06:51 AM   #2 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,445
OS: Windows


Re: Brickwall Game [Help]

missing subs code for RemoveRedBrick() also green and yellow

http://smallbasic.com/smallbasic.com/program/?QRQ360
__________________
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-30-2009, 12:35 PM   #3 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

Thanks for the reply.
I think I do, but I did forget to attach all of the code. I accidentally chopped off some of the last, and I reattached the whole thing. I do have the subs for removing the bricks (near the end), but the bricks still aren't getting taken out.


Code:
'paddle = GraphicsWindow.AddRectangle(120,  12) 'v0.2
paddle = Shapes.AddRectangle(120, 12) 'v0.3.1
'ball = GraphicsWindow.AddEllipse(16,  16) 'v0.2
ball = Shapes.AddEllipse(16, 16) 'v.0.3.1
bricksLeft = 48
brickStartY = 35
hitcount = 0
GraphicsWindow.FontSize = 14
GraphicsWindow.MouseMove = OnMouseMove
GraphicsWindow.Title = "Brickwall Game"

For idx = 0 To 15
  Array.SetValue("Green Bricks", idx, 1)
  Array.SetValue("Yellow Bricks", idx, 1)
  Array.SetValue("Red Bricks", idx, 1)
EndFor
DrawBricks()
score = 0
PrintScore()

gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
y = gh - 28
'GraphicsWindow.MoveShape(ball, x, y) 'v0.2
Shapes.Move(ball,x,y) 'v0.3.1
deltaX = 1
deltaY = -2
Sound.PlayBellRingAndWait()

RunLoop:
x = x + deltaX
y = y + deltaY

gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
If (x >= gw - 16 Or x <= 0) Then
  deltaX = -deltaX
EndIf
  If (y <= 0) Then
    deltaY = -deltaY
  EndIf
  
  'padX = GraphicsWindow.GetLeftOfShape(paddle) 'v0.2
  padX = Shapes.GetLeft(paddle) 'v.0.3.1
  If ((y >= gh - 28 + 2) And x >= padX And x <= padX + 120) Then
    y = gh - 28 + 2
    'Sound.PlayClick()
    hitcount = hitcount + 1
    If Math.Remainder(hitcount, 3) = 0 Then 'Move brick downwards
      For idx = 0 To 15
        RemoveGreenBrick()
        RemoveYellowBrick()
        RemoveRedBrick()
      Endfor
      brickStartY = brickStartY + 20
      DrawBricks()
    EndIf
    TestRed:
    For idx = 0 To 15
      If Array.GetValue("RedBricks", idx) = 1 Then
        If brickStartY > gh - 160 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    TestYellow:
    For idx = 0 To 15
      If Array.GetValue("YellowBricks", idx) = 1 Then
        If brickStartY > gh - 100 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    TestGreen:
    For idx = 0 To 15
      If Array.GetValue("GreenBricks", idx) = 1 Then
        If brickStartY > gh - 40 Then
          Goto EndGame
        EndIf
      EndIf
    EndFor
    EndTest:
    
    deltaX = deltaX - 2 + (x -padX) / 30  ' Add some skill
    
    If score = oldScore Then  'No bricks hit
      score = score - 1
    EndIf
    oldScore = score
    PrintScore()
    deltaY = -deltaY 'Change the ball direction
  EndIf
  'GraphicsWindow.MoveShape(ball, x, y) 'v0.2
  Shapes.Move(ball,x,y) 'v0.3.1
  Program.Delay(5)
  
  'Green Bricks
  If y > brickStartY - 16 And y < brickstartY + 20 Then 'y position of brick - diameter of ball
    idx = (x+8) / 40 '  Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("GreenBricks", idx) = 1 Then
      Array.SetValue("GreenBricks", idx, 0)
      RemoveGreenBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY 'Change ball direction
      score = score + 15
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  
  'Yellow Bricks
  If y > brickStartY + 44 And y < brickStartY + 80 Then ' y position of brick - diameter of ball = 19
    idx = (x+8) / 40 'Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("YellowBricks", idx) = 1 Then
      Array.SetValue("YellowBricks", idx, 0)
      RemoveYellowBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY 'Change ball direction
      score = score + 10
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  
  'Red Bricks
  If y > brickStartY + 104 And y < brickStartY + 140 Then 'y position of brick - diameter of ball = 19
    idx = (x+8) / 40 'Radius of ball / length of brick
    idx = Math.Floor(idx) 'take integer part
    If Array.GetValue("RedBricks", idx) = 1 Then
      Array.SetValue("RedBricks", idx, 0)
      RemoveRedBrick()
      Sound.PlayChime()
      bricksLeft = bricksLeft - 1
      deltaY = -deltaY ' Change ball direction
      score = score + 5
      PrintScore()
      CheckEnd()
    EndIf
  EndIf
  If (y < gh) Then 'Ball not reached bottom of window
    Goto RunLoop
  EndIf
  
  EndGame:
  GraphicsWindow.ShowMessage("Thanks, for playing Brickwall, and your score is : " + score, "Brickwall Game")
  Program.End()
  
  Sub OnMouseMove
    paddleX = GraphicsWindow.MouseX
    'GraphicsWindow.MoveShape(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.2
    Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.3.1
  EndSub
  
  Sub PrintScore
    ' Clear the score first and then draw the real score text
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(10, 10, 200, 20)
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.DrawText(10, 10, "Your score is: " + score)
  EndSub
  
  Sub DrawBricks
    For idx = 0 To 15 'Draw bricks
      'Program.Delay(100)
      If Array.GetValue("GreenBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Green"
        Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY, 40, 20)
      
      GraphicsWindow.BrushColor = "Yellow"
      If Array.GetValue("YellowBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Yellow"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20)
      
      GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.PenColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
    EndFor
  EndSub
  
  Sub RemoveGreenBrick 
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(idx * 40, brickStartY, 40, 20)
    GraphicsWindow.DrawRectangle(idx * 40, brickStartY, 40, 20)
  EndSub
  
  Sub RemoveYellowBrick
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20)
    GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20)
  EndSub
  
  Sub RemoveRedBrick
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.BrushColor = "White"
    GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
    GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
  EndSub
  
  Sub CheckEnd
    If bricksLeft = 0 Then
      GraphicsWindow.ShowMessage("Congrats, you finished the game! Your score is: " + score, "Brickwall Game")
      'Goto GameStart
      Program.End()
      'Goto EndGame
    EndIf
  EndSub
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-30-2009, 09:21 PM   #4 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,445
OS: Windows


Re: Brickwall Game [Help]

checked it and semantically it's correct, so looked at the syntax and noticed some comments were used to block code of older smallbasic versions--and there in lies your problem.

Small Basic v0.3 updates
Quote:
Here is a list of breaking changes in v0.3. These are important because you might have to update some of your programs to run on this.

Shapes object: The GraphicsWindow has been factored out and there's now a new Shapes object. This object contains operations like AddRectangle, AddEllipse, etc. These methods used to be on GraphicsWindow and now they are no more. If your program used them, you'd have to modify your program to match the new pattern.
SmallBasic blog if you want to try track down the version/change that's hanging the code.

some other links you might be useful...
Small Basic API Reference

Small Basic Wiki

have fun.
__________________
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-01-2009, 09:46 AM   #5 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

I have both versions in my program. Does this mean that even though I have 0.3.1 version, would I still have to take out all the 0.2 versions? Also, I looked through my code, and I don't see any old lines for removing the bricks.
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.

Last edited by Jason09; 07-01-2009 at 09:49 AM.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-07-2009, 09:23 AM   #6 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

Do you think there may be something wrong specifically with the codes for removing the bricks?
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-08-2009, 12:19 AM   #7 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,445
OS: Windows


Re: Brickwall Game [Help]

nothing wrong with the original code http://smallbasic.com/program/?QRQ360

the mistake is in your version...see it now?

Code:
  GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.PenColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
    EndFor
  EndSub
__________________
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-08-2009, 08:29 PM   #8 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

That's in the code for drawing bricks, not removing. Someone from another forum was telling me that my code does match up exactly with the listing, and it is probably a strange bug. I assume there really isn't anything that can be done about it. Thanks for the help anyway.
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-08-2009, 11:45 PM   #9 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,445
OS: Windows


Re: Brickwall Game [Help]

WRONG
Code:
   
GraphicsWindow.BrushColor = "Yellow"
      If Array.GetValue("YellowBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Yellow"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White" <--THIS IS RIGHT
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20)
   
      GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow. PenColor = "White" <--THIS IS WRONG
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
    EndFor
  EndSub
RIGHT
Code:
      GraphicsWindow.BrushColor = "Yellow"
      If Array.GetValue("YellowBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Yellow"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20)
      
      GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"  <--CHANGE IT TO THIS
      EndIf
      GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20)
      GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20)
    EndFor
  EndSub
__________________

Last edited by Stu_computer; 07-08-2009 at 11:53 PM.
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-09-2009, 10:01 AM   #10 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

When I change that, it removes the red bricks completley.


Code:
GraphicsWindow.BrushColor = "Red"
      If Array.GetValue("RedBricks", idx) = 1 Then
        GraphicsWindow.PenColor = "Black"
        GraphicsWindow.BrushColor = "Red"
      Else
        GraphicsWindow.PenColor = "White"
        GraphicsWindow.BrushColor = "White"
      EndIf
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-09-2009, 01:39 PM   #11 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,445
OS: Windows


Re: Brickwall Game [Help]

Quote:
When I change that, it removes the red bricks completley.
because there are typos at the beginning of your version.

Quote:
For idx = 0 To 15
Array.SetValue("Green Bricks", idx, 1)
Array.SetValue("Yellow Bricks", idx, 1)
Array.SetValue("Red Bricks", idx, 1)
EndFor
DrawBricks()
score = 0
PrintScore()
Green Bricks is NOT same as GreenBricks, so change to....
GreenBricks
YellowBricks
RedBricks


Just BASIC is free, has dozens of demos, and has a debugger that is useful for stepping thru code to see how it works, (and find errors).
__________________
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-09-2009, 06:42 PM   #12 (permalink)
Moderator, Games Team
 
Jason09's Avatar
 
Join Date: Jan 2009
Location: Near Washington, D.C.
Posts: 2,254
OS: Windows XP Home Edition Service Pack 3

My System

Re: Brickwall Game [Help]

Wow, you're right, that was the problem!
Thanks so much, it now works!
__________________

Gaming troubleshooting steps.


Real peace cannot be found in what happens in Washington, D.C. Only God can give true peace to people.
Jason09 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 06:18 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85