Is there any thing wrong with this?
Author |
Message |
starcraft
|
Posted: Mon Jun 12, 2006 5:25 pm Post subject: Is there any thing wrong with this? |
|
|
I don't get it, it works fine at my house, but at school, it doesn't work.
code: | %Draws the maze for pacman
drawfillbox (40,40,120,120,blue)
drawfillbox (160,0,200,120,blue)
drawfillbox (40,160,160,200,blue)
drawfillbox (0,240,80,280,blue)
drawfillbox (0,280,40,320,blue)
drawfillbox (80,320,120,360,blue)
drawfillbox (40,360,120,440,blue)
drawfillbox (120,240,160,280,blue)
drawfillbox (160,440,200,480,blue)
drawfillbox (160,360,400,400,blue)
drawfillbox (240,400,280,440,blue)
drawfillbox (320,440,360,480,blue)
drawfillbox (440,360,520,400,blue)
drawfillbox (520,360,600,440,blue)
drawfillbox (480,320,520,360,blue)
drawfillbox (560,280,600,320,blue)
drawfillbox (520,240,600,280,blue)
drawfillbox (440,160,600,200,blue)
drawfillbox (440,40,480,160,blue)
drawfillbox (520,240,600,280,blue)
drawfillbox (520,40,600,120,blue)
drawfillbox (400,80,440,120,blue)
drawfillbox (360,0,400,40,blue)
drawfillbox (320,0,360,120,blue)
drawfillbox (240,40,280,160,blue)
drawfillbox (200,160,240,320,blue)
drawfillbox (240,160,400,200,blue)
drawfillbox (360,200,400,320,blue)
drawfillbox (240,280,280,320,blue)
drawfillbox (320,280,360,320,blue)
drawfillbox (400,240,480,280,blue)
%Moves the pacman.
for B4ingamemove1 : 0 .. 120
Draw.FillArc (20+B4ingamemove1,620,18,18,10,310,yellow)
Draw.FillArc (20+B4ingamemove1,620,18,18,10,180,brightred)
delay (10)
Draw.FillArc (20+B4ingamemove1,620,18,18,10,310,0)
Draw.FillArc (20+B4ingamemove1,620,18,18,10,180,0)
end for
for B4ingamemove2 : 0 .. 40
Draw.FillArc (140,620-B4ingamemove2,18,18,10,310,yellow)
Draw.FillArc (140,620-B4ingamemove2,18,18,10,180,brightred)
delay (10)
Draw.FillArc (140,620-B4ingamemove2,18,18,10,310,0)
Draw.FillArc (140,620-B4ingamemove2,18,18,10,180,0)
end for |
The maze show up, butfor some reason, the pacman willnot show, it's just all blank? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
starcraft
|
Posted: Mon Jun 12, 2006 5:28 pm Post subject: (No subject) |
|
|
Oh wait, never mind, I figured out my problem. |
|
|
|
|
![](images/spacer.gif) |
Mr. T
![](http://www.madpaintballer.com/images/purepwnage.gif)
|
Posted: Mon Jun 12, 2006 8:28 pm Post subject: Alex's Opinion |
|
|
To avoid all that tedious drawing, try using a grid and working out of a text file. |
|
|
|
|
![](images/spacer.gif) |
starcraft
|
Posted: Mon Jun 12, 2006 9:44 pm Post subject: (No subject) |
|
|
I did make a grid, like this
code: | %plan a grid for pacman.
%draw the horizontal lines.
drawline (0,0,640,0,black)
drawline (0,40,640,40,black)
drawline (0,80,640,80,black)
drawline (0,120,640,120,black)
drawline (0,160,640,160,black)
drawline (0,200,640,200,black)
drawline (0,240,640,240,black)
drawline (0,280,640,280,black)
drawline (0,320,640,320,black)
drawline (0,360,640,360,black)
drawline (0,400,640,400,black)
drawline (0,440,640,440,black)
drawline (0,479,640,479,black)
%draw the vertical lines.
drawline (0,0,0,480,black)
drawline (40,0,40,480,black)
drawline (80,0,80,480,black)
drawline (120,0,120,480,black)
drawline (160,0,160,480,black)
drawline (200,0,200,480,black)
drawline (240,0,240,480,black)
drawline (280,0,280,480,black)
drawline (320,0,320,480,black)
drawline (360,0,360,480,black)
drawline (400,0,400,480,black)
drawline (440,0,440,480,black)
drawline (480,0,480,480,black)
drawline (520,0,520,480,black)
drawline (560,0,560,480,black)
drawline (600,0,600,480,black)
drawline (639,0,639,480,black) |
|
|
|
|
|
![](images/spacer.gif) |
TheOneTrueGod
![](http://www.drmcninja.com/images/mcninjab3.jpg)
|
Posted: Mon Jun 12, 2006 9:47 pm Post subject: (No subject) |
|
|
What he means is use math... Computer science is ALL about math, and applying it. In this situation, everything is 40 apart (except for an error on your part, causing the first two lines to be 41 apart, and the last two to be 39.)
Try a for loop and some math
code: | for i : 1..whatever
drawline(0,i*40-1,maxx,i*40-1,black)
end for |
Not to mention that your window will not work on 800X600 screens... |
|
|
|
|
![](images/spacer.gif) |
starcraft
|
Posted: Mon Jun 12, 2006 10:37 pm Post subject: (No subject) |
|
|
oh, I C, I didn't know about that at all.
And, the 39/41is therebecause if I don't set it too that, it will not show up on the run window.
I was told to do this at the begining of my program.
code: |
setscreen ("graphics:v256")
setscreen ("graphics:640,480")
|
|
|
|
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Tue Jun 13, 2006 9:13 am Post subject: (No subject) |
|
|
yes thats nice, but wouldnt you want your game to run in a full size window and output elements that are always lined up where you want them according to proportion and not guess values? It has a lot of advantages, for eg: say after you are almost done making a game, just end part of the game is remaining, but you conclude that the end part is gonna need say more than maxy you currently have, then you wil have to change all the drawings, text y's... instead here you could just change it using setscreen, and they will be automatically lined up ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|