Informations sur: DepImag2.BAS

Publié par SFLPMEA le 25/04/2006

Description

Source Qbasic. DepImag2.BAS. C'est le programme DepImage.Bas (AngeNoir) adapté pour SCREEN 12 : déplacement d'un beignet de centre vide sur fond d'écran de couleurs variées. Par SFLPMEA.

Code source (langage qbasic)

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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
'--- 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
 
v6 © Computaid SPRL 2005-2008 - Tous droits réservés - Hébergé par eTigris - Page générée en 0,041 s - Crédits - Stats
1 connecté