Bonjour, =)
j'ai commence a utilise pyhton
et j'ai fais "un jeu" de basketball et j'ai quelque souci
je n'arrive a faire rebondir la balle
ensuit je n'arrive pas a tourner en boucle ce programme

j'ai besoin un petit peu d'aide

merci d'avance

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#####################################################
#
# 
#	BASKET BALL
# 
#
#####################################################
 
# -*- coding: cp1252 -*-
#-*- coding: utf-8 -*-
 
# LES IMPORTS
 
import random
from visual import *
scene.stereo = 'passive'
 
 
################ INTERFACE ###############################
 
terrain = box(pos=(0,0,0), length=80, height=1, width=80, color=color.green)
feild = box(pos=(0,0,0), length=80, height=1, width=60, color=color.white)
 
 
batton=box(pos=(39,10,0), length=2, height=20, width=2, color=color.yellow)
hooK=box(pos=(39,30,0), length=1, height=20, width=20, color=color.red)
Ring=ring(pos=(34,30,1), axis=(0,1,0), radius=5, thickness=0.1, color=color.white)
 
ball=sphere(pos=(0,3,0), radius=3, color=color.orange)
 
################ Balle en Movement ###########################
 
ball.velocity = vector(25,28,0)
deltat = 0.005
t = 0
 
 
 
while t < 6:
 
	rate(100)
	if ball.pos.x > Ring.pos.y+2:
		ball.velocity.x = 0
		ball.velocity.y = -ball.velocity.y-15
	ball.pos = ball.pos + ball.velocity*deltat
	t = t + deltat