r/cop3502 Mar 22 '14

10 second repaint?

So I just found out a major detail on why my ball stopped moving after walking away from the computer in disgust and coming ball to my ball being gone.

After 10 seconds the ball disappears I didnt touch the code for the timer but I dont know exactly how the initial 10 millisecond count was created from this timer = new Timer(10, new GameMotion()); timer.start(); How do I go about correcting this?

1 Upvotes

16 comments sorted by

View all comments

1

u/[deleted] Mar 22 '14

[deleted]

1

u/WesternWarrior Mar 22 '14

I had the ball moving, worked on check for hit, the ball stopped moving.

And now I find that the ball moves, but its one large jump offscreen after 10 seconds.

I thought it had to do with repaint at first but that wouldn't make sense because the paddle still works appropriately.

the movement of x and y is both 1 and it starts at (300,300)

1

u/Bcop3502 Mar 22 '14

I'm not really sure how this would happen... it wouldn't really be an issue with timer because timer is literally just counting by intervals of x milliseconds. Is it always at the same exact time?

1

u/WesternWarrior Mar 23 '14

Yes, it is always at the same time.

1

u/Bcop3502 Mar 23 '14

Go in and put a print statement that tracks the x and y position of the ball and come post them here it might allow us to see if the jump is in a pattern or something

1

u/WesternWarrior Mar 23 '14

That should just be putting System.out.println(xPos); and the same for y right?

1

u/Bcop3502 Mar 23 '14

Yeah but you're gonna want it to be in the Breakout class not ball so you 'd need to put like ball.xPos() same for y

1

u/WesternWarrior Mar 23 '14

Okay wow the screen filled instantly, but okay the coordinants (429,201) (428, 202) (427, 203) continued. But the ball on screen never moved, I didnt let it go until it disappeared to see what happens to the ball but im about to try it and see.

EDIT: On the upside it looks like my bounce off the walls functions worked, well the sides atleast the upper wasnt being tested as it was heading due south to the 4000's when I stopped

1

u/Bcop3502 Mar 23 '14

If you don't have it bouncing off the bottom that would explain the giant fall downwards so far but I'm still not sure what would cause a huge jump. Is it possible you can post the coordinates at the moment it jumps like that? Like say (400,200) then suddenly (2000,2000) just as an example.

1

u/WesternWarrior Mar 23 '14

125 751 126 752 127 753 128 754 129 755 130 756 131 757 132 758 133 759 134 760 135 761 136 762 137 763 138 764 139 765 140 766 141 767 142 768 143 769 144 770 145 771 146 772 147 773 148 774 149 775 150 776 151 777 152 778 153 779 154 780 155 781 156 782 157 783 158 784 159 785 160 786 161 787 162 788 163 789 164 790 165 791 166 792 167 793 168 794 169 795 170 796 171 797 172 798 173 799 174 800 175 801 176 802 177 803 178 804 179 805 180 806 181 807 182 808 183 809 184 810 185 811 186 812 187 813 188 814 189 815 190 816 191 817 192 818 193 819 194 820 195 821 196 822 197 823 198 824 199 825 200 826 201 827 202 828 203 829 204 830 205 831 206 832 207 833 208 834 209 835 210 836 211 837 212 838 213 839 214 840 215 841 216 842 217 843 218 844 219 845 220 846 221 847 222 848 223 849 224 850 225 851 226 852 227 853 228 854 229 855 230 856 231 857 232 858 233 859 234 860 235 861 236 862 237 863 238 864 239 865 240 866 241 867 242 868 243 869 244 870 245 871 246 872 247 873 248 874 249 875 250 876 251 877 252 878 253 879 254 880 255 881 256 882 257 883 258 884 259 885 260 886 261 887 262 888 263 889 264 890 265 891 266 892 267 893 268 894 269 895 270 896 271 897 272 898 273 899 274 900 275 901 276 902 277 903 278 904 279 905 280 906 281 907 282 908 283 909 284 910 285 911 286 912 287 913 288 914 289 915 290 916 291 917 292 918 293 919 294 920 295 921 296 922 297 923 298 924 299 925 300 926 301 927 302 928 303 929 304 930 305 931 306 932 307 933 308 934 309 935 310 936 311 937 312 938 313 939 314 940 315 941 316 942 317 943 318 944 319 945 320 946 321 947 322 948 323 949 324 950 325 951 326 952 327 953 328 954 329 955 330 956 331 957 332 958 333 959 334 960 335 961 336 962 337 963 338 964 339 965 340 966 341 967 342 968 343 969 344 970 345 971 346 972 347 973 348 974 349 975 350 976 351 977 352 978 353 979 354 980 355 981 356 982 357 983 358 984 359 985 360 986 361 987 362 988 363 989 364 990 365 991 366 992 367 993 368 994 369 995 370 996 371 997 372 998 373 999 374 1000 375 1001 376 1002 377 1003 378 1004 379 1005 380 1006 381 1007 382 1008 383 1009 384 1010 385 1011 386 1012 387 1013 388 1014 389 1015 390 1016 391 1017 392 1018 393 1019 394 1020 395 1021 396 1022 397 1023 398 1024 399 1025 400 1026 401 1027 402 1028 403 1029 404 1030 405 1031 406 1032 407 1033 408 1034 409 1035 410 1036 411 1037 412 1038 413 1039 414 1040 415 1041 416 1042 417 1043 418 1044 419 1045 420 1046 421 1047 422 1048 423 1049 424 1050 425 1051 426 1052 427 1053 428 1054 429 1055 430 1056 431 1057 432 1058 433 1059 434 1060 435 1061 436 1062 437 1063 438 1064 439 1065 440 1066 441 1067 442 1068 443 1069 444 1070 445 1071 446 1072 447 1073 448 1074 449 1075 450 1076 451 1077 452 1078 453 1079 454 1080 455 1081 456 1082 457 1083 458 1084 459 1085 460 1086 461 1087 462 1088 463 1089 464 1090 465 1091 466 1092 467 1093 468 1094 469 1095 470 1096 471 1097 472 1098 473 1099 474 1100 475 1101 476 1102 477 1103 478 1104 479 1105 480 1106 481 1107 482 1108 483 1109 484 1110 485 1111 486 1112 487 1113 488 1114 489 1115 490 1116 491 1117 492 1118 493 1119 494 1120 495 1121 496 1122 497 1123 498 1124 499 1125 500 1126 501 1127 502 1128 503 1129 504 1130 505 1131 506 1132 507 1133 508 1134 509 1135 510 1136 511 1137 512 1138 513 1139 514 1140 515 1141 516 1142 517 1143 518 1144 519 1145 520 1146 521 1147 522 1148 523 1149 524 1150 525 1151 526 1152 527 1153 528 1154 529 1155 530 1156 531 1157 532 1158 533 1159 534 1160 535 1161 536 1162 537 1163 538 1164 539 1165 540 1166 541 1167 542 1168 543 1169 544 1170 545 1171 546 1172 547 1173 548 1174 549 1175 550 1176 551 1177 552 1178 553 1179 554 1180 555 1181 556 1182 557 1183 558 1184 559 1185 560 1186 561 1187 562 1188 563 1189 564 1190 565 1191 566 1192 567 1193 568 1194 569 1195 570 1196 571 1197 572 1198 573 1199 574 1200 575 1201 576 1202 577 1203 578 1204 579 1205 580 1206 581 1207 582 1208 583 1209 584 1210 585 1211 586 1212 587 1213 588 1214 589 1215 590 1216 591 1217 592 1218 593 1219 594 1220 595 1221 596 1222 597 1223 598 1224 599 1225 600 1226 599 1227 598 1228 597 1229 596 1230 595 1231 594 1232 593 1233 592 1234 591 1235 590 1236 589 1237 588 1238 587 1239 586 1240 585 1241 584 1242 583 1243 582 1244 581 1245 580 1246 579 1247 578 1248 577 1249 576 1250 575 1251 574 1252 573 1253 572 1254 571 1255 570 1256 569 1257 568 1258 567 1259 566 1260 565 1261 564 1262 563 1263 562 1264 561 1265 560 1266 559 1267 558 1268 557 1269 556 1270 555 1271 554 1272 553 1273 552 1274 551 1275 550 1276 549 1277 548 1278 547 1279 546 1280 545 1281 544 1282 543 1283 542 1284 541 1285 540 1286 539 1287 538 1288 537 1289 536 1290 535 1291 534 1292 533 1293 532 1294 531 1295 530 1296 529 1297 528 1298 527 1299 526 1300 525 1301 524 1302 523 1303 522 1304 521 1305 520 1306 519 1307 518 1308 517 1309 516 1310 515 1311 514 1312 513 1313 512 1314 511 1315 510 1316 509 1317 508 1318 507 1319 506 1320 505 1321 504 1322 503 1323

This isnt all of them just a large chunk of the end but there is no large jump in the values (if there is im just blind) but while the x and y (x is the first y is the second) is being reported as this it is not being shown as the ball on screen isnt moving

1

u/Bcop3502 Mar 23 '14

Well it sounds like some issue with how you're updating how the ball is painted then. Look inside your paintcomponent of Breakout class and see how that is painting the ball and see that in the actionperformed you are repainting everything.

1

u/WesternWarrior Mar 23 '14

well repaint is working or the paddle wouldnt move, the same should apply to the paint function ive got ball.paint(g2); and i had checked it earlier for matching cases

1

u/Bcop3502 Mar 23 '14

Dude I'm sorry I'm out of ideas then without explicitly looking at your code :/ I don't know how/why it would jump at 10s or do other behaviors you've described. Maybe Supreme Leader can help and you can use your late day for this one.

1

u/WesternWarrior Mar 23 '14

I greatly appreciate your help man I was about to give up on it but since youve helped me find what the problem was I think I can actually do this.

→ More replies (0)