Help for Pacman eating dots. Have no idea to do it.
Author |
Message |
Jynx101
|
Posted: Sun May 28, 2017 10:34 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
It's telling me that the variable has no value on the for loop:
%Drawing dots that pacman eat
var dotx : array 1 .. 290 of int
var doty : array 1 .. 290 of int
%X-Coordinates
dotx (1) := 25
dotx (2) := 41
dotx (3) := 57
dotx (4) := 73
dotx (5) := 89
dotx (6) := 105
dotx (7) := 121
dotx (8) := 137
dotx (9) := 153
dotx (10) := 169
dotx (11) := 185
dotx (12) := 201
dotx (13) := 217
dotx (14) := 233
dotx (15) := 249
dotx (16) := 265
dotx (17) := 281
dotx (18) := 297
dotx (19) := 313
dotx (20) := 329
dotx (21) := 345
dotx (22) := 361
dotx (23) := 377
dotx (24) := 393
dotx (25) := 409
dotx (26) := 425
dotx (27) := 25
dotx (28) := 201
dotx (29) := 249
dotx (30) := 425
dotx (31) := 25
dotx (32) := 201
dotx (33) := 249
dotx (34) := 425
dotx (35) := 25
dotx (36) := 41
dotx (37) := 57
dotx (38) := 73
dotx (39) := 89
dotx (40) := 105
dotx (41) := 153
dotx (42) := 169
dotx (43) := 185
dotx (44) := 201
dotx (45) := 249
dotx (46) := 265
dotx (47) := 281
dotx (48) := 297
dotx (49) := 345
dotx (50) := 361
dotx (51) := 377
dotx (52) := 393
dotx (53) := 409
dotx (54) := 425
dotx (55) := 57
dotx (56) := 105
dotx (57) := 153
dotx (58) := 297
dotx (59) := 345
dotx (60) := 393
dotx (61) := 57
dotx (62) := 105
dotx (63) := 153
dotx (64) := 297
dotx (65) := 345
dotx (66) := 393
dotx (67) := 25
dotx (68) := 41
dotx (69) := 57
dotx (70) := 105
dotx (71) := 121
dotx (72) := 137
dotx (73) := 153
dotx (74) := 169
dotx (75) := 185
dotx (76) := 201
dotx (77) := 217
dotx (78) := 233
dotx (79) := 249
dotx (80) := 265
dotx (81) := 281
dotx (82) := 297
dotx (83) := 313
dotx (84) := 329
dotx (85) := 345
dotx (86) := 393
dotx (87) := 409
dotx (88) := 425
dotx (89) := 25
dotx (90) := 105
dotx (91) := 201
dotx (92) := 249
dotx (93) := 345
dotx (94) := 425
dotx (95) := 25
dotx (96) := 105
dotx (97) := 201
dotx (98) := 249
dotx (99) := 345
dotx (100) := 425
dotx (101) := 25
dotx (102) := 41
dotx (103) := 57
dotx (104) := 73
dotx (105) := 89
dotx (106) := 105
dotx (107) := 121
dotx (108) := 137
dotx (109) := 153
dotx (110) := 169
dotx (111) := 185
dotx (112) := 201
dotx (113) := 249
dotx (114) := 265
dotx (115) := 281
dotx (116) := 297
dotx (117) := 313
dotx (118) := 329
dotx (119) := 345
dotx (120) := 361
dotx (121) := 377
dotx (122) := 393
dotx (123) := 409
dotx (124) := 425
dotx (125) := 105
dotx (126) := 153
dotx (127) := 297
dotx (128) := 345
dotx (129) := 105
dotx (130) := 153
dotx (131) := 297
dotx (132) := 345
dotx (133) := 105
dotx (134) := 153
dotx (135) := 169
dotx (136) := 185
dotx (137) := 201
dotx (138) := 217
dotx (139) := 233
dotx (140) := 249
dotx (141) := 265
dotx (142) := 281
dotx (143) := 297
dotx (144) := 345
dotx (145) := 105
dotx (146) := 153
dotx (147) := 297
dotx (148) := 345
dotx (149) := 105
dotx (150) := 153
dotx (151) := 297
dotx (152) := 345
dotx (153) := 105
dotx (154) := 121
dotx (155) := 137
dotx (156) := 153
dotx (157) := 297
dotx (158) := 313
dotx (159) := 329
dotx (160) := 345
dotx (161) := 105
dotx (162) := 153
dotx (163) := 297
dotx (164) := 345
dotx (165) := 105
dotx (166) := 153
dotx (167) := 297
dotx (168) := 345
dotx (169) := 105
dotx (170) := 153
dotx (171) := 169
dotx (172) := 185
dotx (173) := 201
dotx (174) := 217
dotx (175) := 233
dotx (176) := 249
dotx (177) := 265
dotx (178) := 281
dotx (179) := 297
dotx (180) := 345
dotx (181) := 105
dotx (182) := 201
dotx (183) := 249
dotx (184) := 345
dotx (185) := 105
dotx (186) := 201
dotx (187) := 249
dotx (188) := 345
dotx (189) := 25
dotx (190) := 41
dotx (191) := 57
dotx (192) := 73
dotx (193) := 89
dotx (194) := 105
dotx (195) := 153
dotx (196) := 169
dotx (197) := 185
dotx (198) := 201
dotx (199) := 249
dotx (201) := 265
dotx (202) := 281
dotx (203) := 297
dotx (204) := 345
dotx (205) := 361
dotx (206) := 377
dotx (207) := 393
dotx (208) := 409
dotx (209) := 435
dotx (211) := 25
dotx (212) := 105
dotx (213) := 153
dotx (214) := 297
dotx (215) := 345
dotx (216) := 425
dotx (217) := 25
dotx (218) := 105
dotx (219) := 153
dotx (220) := 297
dotx (221) := 345
dotx (222) := 435
dotx (223) := 25
dotx (224) := 41
dotx (225) := 57
dotx (226) := 73
dotx (227) := 89
dotx (228) := 105
dotx (229) := 121
dotx (230) := 137
dotx (231) := 153
dotx (232) := 169
dotx (233) := 185
dotx (234) := 201
dotx (235) := 217
dotx (236) := 233
dotx (237) := 249
dotx (238) := 265
dotx (239) := 281
dotx (240) := 297
dotx (241) := 313
dotx (242) := 329
dotx (243) := 345
dotx (244) := 361
dotx (245) := 377
dotx (246) := 393
dotx (247) := 409
dotx (248) := 425
dotx (249) := 25
dotx (250) := 105
dotx (251) := 201
dotx (252) := 249
dotx (253) := 345
dotx (254) := 425
dotx (255) := 25
dotx (256) := 105
dotx (257) := 201
dotx (258) := 249
dotx (259) := 345
dotx (260) := 425
dotx (261) := 25
dotx (262) := 105
dotx (263) := 201
dotx (264) := 249
dotx (265) := 345
dotx (266) := 425
dotx (267) := 25
dotx (268) := 41
dotx (269) := 57
dotx (270) := 73
dotx (271) := 89
dotx (272) := 105
dotx (273) := 121
dotx (274) := 137
dotx (275) := 153
dotx (276) := 169
dotx (277) := 185
dotx (278) := 201
dotx (279) := 249
dotx (280) := 265
dotx (281) := 281
dotx (282) := 297
dotx (283) := 313
dotx (284) := 329
dotx (285) := 234
dotx (286) := 361
dotx (287) := 377
dotx (288) := 393
dotx (289) := 409
dotx (290) := 425
%Y-Coordinates
doty (1) := 55
doty (2) := 55
doty (3) := 55
doty (4) := 55
doty (5) := 55
doty (6) := 55
doty (7) := 55
doty (8) := 55
doty (9) := 55
doty (10) := 55
doty (11) := 55
doty (12) := 55
doty (13) := 55
doty (14) := 55
doty (15) := 55
doty (16) := 55
doty (17) := 55
doty (18) := 55
doty (19) := 55
doty (20) := 55
doty (21) := 55
doty (22) := 55
doty (23) := 55
doty (24) := 55
doty (25) := 55
doty (26) := 55
doty (27) := 71
doty (28) := 71
doty (29) := 71
doty (30) := 71
doty (31) := 87
doty (32) := 87
doty (33) := 87
doty (34) := 87
doty (35) := 103
doty (36) := 103
doty (37) := 103
doty (38) := 103
doty (39) := 103
doty (40) := 103
doty (41) := 103
doty (42) := 103
doty (43) := 103
doty (44) := 103
doty (45) := 103
doty (46) := 103
doty (47) := 103
doty (48) := 103
doty (49) := 103
doty (50) := 103
doty (51) := 103
doty (52) := 103
doty (53) := 103
doty (54) := 103
doty (55) := 119
doty (56) := 119
doty (57) := 119
doty (58) := 119
doty (59) := 119
doty (60) := 119
doty (61) := 135
doty (62) := 135
doty (63) := 135
doty (64) := 135
doty (65) := 135
doty (66) := 135
doty (67) := 151
doty (68) := 151
doty (69) := 151
doty (70) := 151
doty (71) := 151
doty (72) := 151
doty (73) := 151
doty (74) := 151
doty (75) := 151
doty (76) := 151
doty (77) := 151
doty (78) := 151
doty (79) := 151
doty (80) := 151
doty (81) := 151
doty (82) := 151
doty (83) := 151
doty (84) := 151
doty (85) := 151
doty (86) := 151
doty (87) := 151
doty (88) := 151
doty (89) := 167
doty (90) := 167
doty (91) := 167
doty (92) := 167
doty (93) := 167
doty (94) := 167
doty (95) := 183
doty (96) := 183
doty (97) := 183
doty (98) := 183
doty (99) := 183
doty (100) := 183
doty (101) := 199
doty (102) := 199
doty (103) := 199
doty (104) := 199
doty (105) := 199
doty (106) := 199
doty (107) := 199
doty (108) := 199
doty (109) := 199
doty (110) := 199
doty (111) := 199
doty (112) := 199
doty (113) := 199
doty (114) := 199
doty (115) := 199
doty (116) := 199
doty (117) := 199
doty (118) := 199
doty (119) := 199
doty (120) := 199
doty (121) := 199
doty (122) := 199
doty (123) := 199
doty (124) := 199
doty (125) := 215
doty (126) := 215
doty (127) := 215
doty (128) := 215
doty (129) := 231
doty (130) := 231
doty (131) := 231
doty (132) := 231
doty (133) := 247
doty (134) := 247
doty (135) := 247
doty (136) := 247
doty (137) := 247
doty (138) := 247
doty (139) := 247
doty (140) := 247
doty (141) := 247
doty (142) := 247
doty (143) := 247
doty (144) := 247
doty (145) := 263
doty (146) := 263
doty (147) := 263
doty (148) := 263
doty (149) := 279
doty (150) := 279
doty (151) := 279
doty (152) := 279
doty (153) := 295
doty (154) := 295
doty (155) := 295
doty (156) := 295
doty (157) := 295
doty (158) := 295
doty (159) := 295
doty (160) := 295
doty (161) := 311
doty (162) := 311
doty (163) := 311
doty (164) := 311
doty (165) := 327
doty (166) := 327
doty (167) := 327
doty (168) := 327
doty (169) := 343
doty (170) := 343
doty (171) := 343
doty (172) := 343
doty (173) := 343
doty (174) := 343
doty (175) := 343
doty (176) := 343
doty (177) := 343
doty (178) := 343
doty (179) := 343
doty (180) := 343
doty (181) := 343
doty (182) := 359
doty (183) := 359
doty (184) := 359
doty (185) := 359
doty (186) := 375
doty (187) := 375
doty (188) := 375
doty (189) := 375
doty (190) := 391
doty (191) := 391
doty (192) := 391
doty (193) := 391
doty (194) := 391
doty (195) := 391
doty (196) := 391
doty (197) := 391
doty (198) := 391
doty (199) := 391
doty (201) := 391
doty (202) := 391
doty (203) := 391
doty (204) := 391
doty (205) := 391
doty (206) := 391
doty (207) := 391
doty (208) := 391
doty (209) := 391
doty (211) := 391
doty (212) := 407
doty (213) := 407
doty (214) := 407
doty (215) := 407
doty (216) := 407
doty (217) := 407
doty (218) := 423
doty (219) := 423
doty (220) := 423
doty (221) := 423
doty (222) := 423
doty (223) := 423
doty (224) := 439
doty (225) := 439
doty (226) := 439
doty (227) := 439
doty (228) := 439
doty (229) := 439
doty (230) := 439
doty (231) := 439
doty (232) := 439
doty (233) := 439
doty (234) := 439
doty (235) := 439
doty (236) := 439
doty (237) := 439
doty (238) := 439
doty (239) := 439
doty (240) := 439
doty (241) := 439
doty (242) := 439
doty (243) := 439
doty (244) := 439
doty (245) := 439
doty (246) := 439
doty (247) := 439
doty (248) := 439
doty (249) := 439
doty (250) := 455
doty (251) := 455
doty (252) := 455
doty (253) := 455
doty (254) := 455
doty (255) := 455
doty (256) := 471
doty (257) := 471
doty (258) := 471
doty (259) := 471
doty (260) := 471
doty (261) := 471
doty (262) := 487
doty (263) := 487
doty (264) := 487
doty (265) := 487
doty (266) := 487
doty (267) := 487
doty (268) := 503
doty (269) := 503
doty (270) := 503
doty (271) := 503
doty (272) := 503
doty (273) := 503
doty (274) := 503
doty (275) := 503
doty (276) := 503
doty (277) := 503
doty (278) := 503
doty (279) := 503
doty (280) := 503
doty (281) := 503
doty (282) := 503
doty (283) := 503
doty (284) := 503
doty (285) := 503
doty (286) := 503
doty (287) := 503
doty (288) := 503
doty (289) := 503
doty (290) := 503
for i : 1 .. 290
drawfilloval (dotx (i), doty (i), 4, 4, white)
end for |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Jynx101
|
Posted: Sun May 28, 2017 10:57 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
i forgot to add this. it goes at the bottom:
for i : 1 .. 290
drawfilloval (dotx (i), doty (i), 4, 4, white)
end for
for i : 1 .. 290
DotsEaten (i) := false
if DotsEaten (i) = false then
drawfilloval (dotx (i), doty (i), 4, 4, white)
elsif DotsEaten (i) = true then
exit
end if
end for |
|
|
|
|
|
Insectoid
|
Posted: Mon May 29, 2017 5:36 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
What do you think that error message might be trying to tell you? |
|
|
|
|
|
Jynx101
|
Posted: Mon May 29, 2017 8:43 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
Yeah, ik that it says variable has no value, but it doesn't say which variable. It usually highlights which variable has no value, but it highlights the whole drawfilloval statement. |
|
|
|
|
|
Insectoid
|
Posted: Mon May 29, 2017 9:49 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
What variables are in the drawfilloval statement? |
|
|
|
|
|
Jynx101
|
Posted: Mon May 29, 2017 10:24 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
dotx, doty, and i |
|
|
|
|
|
Insectoid
|
Posted: Mon May 29, 2017 10:45 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
No, the variables are dotx (i), doty (i), and i. This includes dotx (0), dotx (10), doty (50), etc.
Do you think it's possible that you simply forgot to initialize one of your dotx or doty variables? Maybe there's a typo and you typed dotx (17) instead of (18)? |
|
|
|
|
|
Jynx101
|
Posted: Mon May 29, 2017 11:44 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
Yeah, you're right. I didn't do several of my dots properly. Thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Jynx101
|
Posted: Mon May 29, 2017 11:47 am Post subject: Re: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
Insectoid @ Sun May 28, 2017 6:14 pm wrote:
Now inside the draw loop, we'll add an if statement:
if dotsEaten (i) == false then
draw.filloval (dotsX (I), dotsY (i), etc)
end if
Now you only need to figure out how to detect if a dot was eaten, and set that dot to true in the eaten array. It will then no longer be drawn. |
|
|
|
|
|
Jynx101
|
Posted: Mon May 29, 2017 11:48 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
Btw, when you said to do the if statement, in english this says that is none of the dots are eaten, to draw all of them, right? |
|
|
|
|
|
Insectoid
|
Posted: Mon May 29, 2017 12:12 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
That if statement goes inside a loop. It looks at each dot, asks 'has this been eaten yet?' and then draws or doesn't, depending on the answer. |
|
|
|
|
|
Jynx101
|
Posted: Tue May 30, 2017 8:33 am Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
So i did it using collision detection, but it isn't working...
for i : 1 .. 288
drawfilloval (dotx (i), doty (i), 2, 2, white)
DotsEaten (i) := false
if DotsEaten (i) = false then
drawfilloval (dotx (i), doty (i), 2, 2, white)
elsif DotsEaten (i) = true then
drawfilloval (dotx (i), doty (i), 3, 3, black)
end if
if whatdotcolor (x + r, y) = white or whatdotcolor (x + r, y + r) = white or whatdotcolor (x + r, y - r) = white then
DotsEaten (i) := true
end if
end for |
|
|
|
|
|
Insectoid
|
Posted: Tue May 30, 2017 2:43 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
You've got all the pieces, but they're all in the wrong spots. Tell me, does this make sense?
DotsEaten (i) := false
if DotsEaten (i) = false then
Think about that for a minute- what exactly is happening here?
You need to break that big loop up into several smaller loops. |
|
|
|
|
|
Jynx101
|
Posted: Tue May 30, 2017 8:45 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
oh right...i'm stupid...its already set at false drawing all the dots |
|
|
|
|
|
The one they call Greed
|
Posted: Wed May 31, 2017 12:00 pm Post subject: RE:Help for Pacman eating dots. Have no idea to do it. |
|
|
You are making every dot false every time it is scanned. Move that into a different loop and that should fix everything |
|
|
|
|
|
|
|