'--- Cr‚ation … partir d'un autre programme et modifi‚ l‚gŠrement.--- '--- Pris sur QbasicNews.com mais reste en anglais. --- '--- Fonctionne trŠs bien sur QuickBasic 4.5 fr Windows XP. --- ' *** Modifi‚ par SFLPMEA pour SCREEN 12 ' *** Compl‚t‚: Ajout de TOUS SENS de d‚placement SCREEN 12 DIM picture(63), sprite(63), spritesh(63) ' *** Note de SFLPMEA : ' Les Tables ‚taient nettement SURdimentionn‚es ..... (1000) CIRCLE (10, 10), 10, 14: PAINT (10, 10), 14, 14 CIRCLE (10, 10), 6, 1: PAINT (10, 10), 1, 1 GET (0, 0)-(20, 20), sprite LINE (0, 0)-(20, 20), 17, BF CIRCLE (10, 10), 10, 4: PAINT (10, 10), 4, 4 CIRCLE (10, 10), 6, 1: PAINT (10, 10), 1, 1 GET (0, 0)-(20, 20), spritesh CLS FOR I = 0 TO 60000 Couleur = INT(RND * 4) SELECT CASE Couleur: CASE 1: Couleur = 6 CASE 2: Couleur = 8 Couleur = 3: Couleur = 2 END SELECT PSET ((RND * 640), (RND * 480)), Couleur NEXT I FOR Y = 1 TO 480 STEP 16: FOR X = 1 TO 640 STEP 16 LINE (X, Y)-(640 - X, 480 - Y), (RND * 16) NEXT X, Y X = 1: Y = 1 'Sprite X and Y coords D.X = 1: D.Y = 1 'Moves the ball Temporisation = 40000 'Ajustement de la vitesse ' **** peut se faire autrement (Adaptation automatique au PC) GET (X, Y)-(X + 20, Y + 20), picture 'Get the background '---=============================================================--- DO ' DEBUT de la BOUCLE ' *** Modification de la vitesse et sortie de la boucle ' *** Modification du sens de direction K$ = INKEY$ SELECT CASE K$ CASE CHR$(27): END ' *** Vitesse d'ex‚cution CASE "+": BEEP: Temporisation = Temporisation * .75 CASE "-": BEEP: Temporisation = Temporisation * 1.25 ' *** Sens de d‚placement CASE "1", CHR$(0) + "O": ' au sud ouest D.X = -1: D.Y = 1 CASE "2", CHR$(0) + "P": ' au sud D.X = 0: D.Y = 1 CASE "3", CHR$(0) + "Q": ' au sud est D.X = 1: D.Y = 1 CASE "4", CHR$(0) + "K": ' … l'ouest D.X = -1: D.Y = 0 CASE "5": ' STOP D.X = 0: D.Y = 0 CASE "6", CHR$(0) + "M" ' … l'est D.X = 1: D.Y = 0 CASE "7", CHR$(0) + "G": ' au Nord Ouest D.X = -1: D.Y = -1 CASE "8", CHR$(0) + "H": ' au Nord D.X = 0: D.Y = -1 CASE "9", CHR$(0) + "I": ' au Nord Est D.X = 1: D.Y = -1 END SELECT PUT (X, Y), spritesh, AND ' put the sprite down PUT (X, Y), sprite, OR Ancien.X = X ' Ancienne position Ancien.Y = Y X = X + D.X ' Position Suivante Y = Y + D.Y 'WAIT &H3DA, 8 'This just keeps things clean, don't worry about it... ' *** Doit faire double emploi avec bouclette de temporisation ? PUT (Ancien.X, Ancien.Y), picture, PSET 'Put the old background down... GET (X, Y)-(X + 20, Y + 20), picture 'Get The new background 'PUT (x, y), sprite, PSET 'Finally, put the sprite down... PUT (X, Y), spritesh, AND ' put the sprite down PUT (X, Y), sprite, OR ' **** Il est pr‚f‚rable de mettre la temporisation ' **** APRES les PUT pour obtenir un meilleur affichage du dessin FOR I = 1 TO Temporisation: NEXT ' *** pour faire rebondir la balle IF Y > 450 THEN D.Y = -1 IF Y < 10 THEN D.Y = 1 IF X > 610 THEN D.X = -1 IF X < 10 THEN D.X = 1 LOOP ' FIN de la boucle