Informations sur: Coloration du code n° 55

Publié par neliger le 24/04/2006

Description

Coloration du code n° 55

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
'--- Création à partir d'un autre programme et modifier légèrement.---
'---         Pris sur QbasicNews.com mais reste en anglais.        ---
'---     Fonctionne très bien sur QuickBasic 4.5 fr Windows XP.    ---
 
DIM picture(1000), sprite(1000), spritesh(1000)
 
SCREEN 13
CIRCLE (10, 10), 10, 4
PAINT (10, 10), 1, 4
CIRCLE (10, 10), 6, 4
PAINT (10, 10), 0, 4
GET (0, 0)-(20, 20), sprite
LINE (0, 0)-(20, 20), 255, BF
CIRCLE (10, 10), 10, 4
PAINT (10, 10), 1, 4
CIRCLE (10, 10), 6, 4
PAINT (10, 10), 255, 4
 
GET (0, 0)-(20, 20), spritesh
CLS
FOR i = 0 TO 5555 STEP .1
   Cc = 0 + INT(RND * 4)
   IF Cc = 0 THEN Cc = 0
   IF Cc = 1 THEN Cc = 6
   IF Cc = 2 THEN Cc = 8
   IF Cc = 3 THEN Cc = 2
   PSET ((RND * 320), (RND * 200)), Cc
NEXT i
 
FOR y = 1 TO 200 STEP 16
  FOR x = 1 TO 320 STEP 16
     LINE (x, y)-(320 - x, 200 - y), (RND * 15)
NEXT: NEXT
 
x = 1: y = 1           'Sprite X and Y coords
xadj = 1: yadj = 1     'Moves the ball
delay = 40000          'Adjust this for speed...
 
GET (x, y)-(x + 20, y + 20), picture  'Get the background
'---=============================================================---
DO                'Start loop
press$ = INKEY$   'get ready for key presses...
 
PUT (x, y), spritesh, AND  ' put the sprite down
PUT (x, y), sprite, OR
 
oldx = x           'Record old position
oldy = y
 
x = x + xadj      'Move the ball
y = y + yadj
 
WAIT &H3DA, 8      'This just keeps things clean, don't worry about it...
 
PUT (oldx, oldy), 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
 
IF y > 170 THEN yadj = -1       'This is if it hits the walls...
IF y < 10 THEN yadj = 1
IF x > 290 THEN xadj = -1
IF x < 10 THEN xadj = 1
 
FOR i = 1 TO delay: NEXT       'This adds a delay, If its to fast or slow...
 
LOOP UNTIL press$ = CHR$(27)   'Loop until Escape is pressed... 
 
v6 © Computaid SPRL 2005-2008 - Tous droits réservés - Hébergé par eTigris - Page générée en 0,024 s - Crédits - Stats
1 connecté