예제 #1
0
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics, pygame, sys, math
from pygame.locals import *
from funcs import *

pygame.init()
fen = pygame.display.set_mode((1024, 560))

systeme = physics.System()

systeme.addobject(physics.PhysObject(60, 500, 190000))
systeme.addobject(physics.PhysObject(700, 150, 250000))
systeme.addobject(physics.PhysObject(300, 250, 220000))

systeme.setgravity()
systeme.objectlist[0].posx_ = 60.2
systeme.objectlist[0].posy_ = 500.4
systeme.objectlist[1].posx_ = 699.9
systeme.objectlist[1].posy_ = 149.4
systeme.objectlist[2].posx_ = 299.9
systeme.objectlist[2].posy_ = 250.4
systeme.pas = 0.01
systeme.setpas()


def main():
예제 #2
0
#
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics, pygame, sys, math, time, random
from pygame.locals import *
from funcs import *

pygame.init()
fen = pygame.display.set_mode((1024, 560))

systeme = physics.System()
systeme.addobject(physics.PhysObject(200, 250, 15000))
for i in range(5):
    systeme.addobject(physics.PhysObject(random.randint(400, 800), 250, 15000))
for i in systeme.objectlist:
    i.addforce(physics.Frottements(i, 7, 3), True)
systeme.pas = 0.1
systeme.setpas()
#systeme.setgravity()
systeme.objectlist[0].vitx = +100
systeme.objectlist[0].vity = 0
systeme.collisions = True
for i in systeme.objectlist:
    i.size = 10


def main():
예제 #3
0
#!/usr/bin/env python

import physics, pygame, sys, math, random
from pygame.locals import *
from funcs import *
import time

pygame.init()
fenx, feny = 1024, 560
fen = pygame.display.set_mode((fenx, feny))

systeme = physics.System()

for i in range(60):
    systeme.addobject(
        physics.PhysObject(random.randint(0, fenx), random.randint(0, feny),
                           random.randint(5000, 30000)))
systeme.setgravity()
systeme.split()


def main():
    boucle = 1
    running = False
    trace = False
    while boucle:
        for event in pygame.event.get():
            if event.type == QUIT:
                boucle = 0
            if event.type == KEYDOWN:
                if event.key == K_SPACE:
                    running = obool(running)
예제 #4
0
import physics, pygame, sys, math
from pygame.locals import *
from funcs import *
#quelques constantes
m = 1800
M = 19000
pichenette = 300

#creation de l'interface graphique
pygame.init()
fen = pygame.display.set_mode((1024, 560))
#pygame.key.set_repeat(30, 30)
fen.fill((255, 255, 255))

#definition des objets
planete2 = physics.PhysObject(800, 100, m)
planete = physics.PhysObject(800, 250, M)
#planete.ch_pas(0.01)
#planete2.ch_pas(0.01)

#definition des forces
attraction_plan = physics.Attraction_grav(planete2, planete)
attraction_tri = physics.Attraction_grav(planete, planete2)
boost = physics.Force(0, 0)

#application des forces
planete2.addforce(boost)
planete2.addforce(attraction_plan, True)
planete.addforce(attraction_tri, True)

#vitesse initiale
예제 #5
0
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics, pygame, sys, math, time
from pygame.locals import *
from funcs import *

pygame.init()
fen = pygame.display.set_mode((1024, 560))

systeme = physics.System()

systeme.addobject(physics.PhysObject(900, 150, 15000))
systeme.addobject(physics.PhysObject(600, 150, 15000))
systeme.pas = 0.1
systeme.setpas()
#systeme.setgravity()
systeme.objectlist[0].vitx = -50
systeme.objectlist[1].vitx = -5
systeme.collisions = True
for i in systeme.objectlist:
    i.size = 20


def main():
    boucle = 1
    running = False
    trace = False
예제 #6
0
#quelques constantes
masse_bille = 10
Lo = 90
k = 10
g = 9.81
pas = 0.1


#creation de l'interface graphique
pygame.init()
fen = pygame.display.set_mode((1024,560))
fen.fill((255,255,255))

#definition des objets
bille = physics.PhysObject(400,250,masse_bille)
point = physics.PhysObject(500,250,1)
bille.ch_pas(pas)

#definition des forces
f_elas = physics.ForceElastique(bille,point,Lo,k)
poids = physics.Force(0,g*masse_bille)
frottements = physics.Frottements(bille,0.01,1)

#application des forces
bille.addforce(poids)
bille.addforce(f_elas,True)
bille.addforce(frottements,True)


#vitesse initiale
예제 #7
0
# Author:      Timosis
#
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics, pygame, sys, math
from pygame.locals import *
import random, time
from funcs import *
pygame.init()
fen = pygame.display.set_mode((1024, 560))
systeme = physics.System()
grosastre = physics.PhysObject(400, 250, 400000)
systeme.addobject(grosastre)
objectlist = []

for i in range(9):
    mhh = physics.PhysObject(400 + (-1)**(i % 2) * 40 * (i + 1), 250,
                             40 * (i + 1))
    mhh.vity = (-1)**(i % 2) * math.sqrt(6 * 400000 / (3 * (i + 1))**2)
    objectlist.append(mhh)

for i in objectlist:
    systeme.addobject(i)

systeme.setgravity()

예제 #8
0
# Author:      Timosis
#
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics,pygame,sys,math
from pygame.locals import *
import random,time
from funcs import *
pygame.init()
fen = pygame.display.set_mode((1024,560))

grosastre = physics.PhysObject(400,250,4000)
grosastre2 = physics.PhysObject(600,250,7000)
objectlist = []
for i in range(1):
	objectlist.append(physics.PhysObject(random.randint(200,500),random.randint(150,300),80))
	
for i in objectlist:	
	i.addforce(physics.Attraction_grav(i,grosastre),True)
	i.addforce(physics.Attraction_grav(i,grosastre2),True)
	i.ch_pas(0.05)

objectlist[0].posx_ = objectlist[0].posx + 0.5
objectlist[0].posy_ = objectlist[0].posy - 0.5
objectlist[0].vitx =  -10
objectlist[0].vity =  10
def main():
예제 #9
0
# Created:     08/04/2013
# Copyright:   (c) Timosis 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

import physics, pygame, sys, math
from pygame.locals import *

pygame.init()
g = 9.81
moteur = 2000
fen = pygame.display.set_mode((1024, 560))
imgtriangle = pygame.image.load("triangle.png").convert_alpha()
pygame.key.set_repeat(30, 30)
triangle = physics.PhysObject(400, 100, 600)
planete = physics.PhysObject(400, 250, 5E3)
attraction_plan = physics.Attraction_grav(triangle, planete)

boost = physics.Force(0, 0)
triangle.addforce(boost)
triangle.addforce(attraction_plan, True)
plan = pygame.Surface((1024, 560))
triangle.vitx = 10
triangle.vity = 0
triangle.ch_pas(0.1)


def main():
    boucle = 1
    while boucle:
예제 #10
0
from funcs import *

#quelques constantes
masse_pi = 5
masse_po = 10
Lo = 100
k = 0.5
pas = 0.05

#creation de l'interface graphique
pygame.init()
fen = pygame.display.set_mode((1024, 560))
fen.fill((255, 255, 255))

#definition des objets
pi = physics.PhysObject(600, 250, masse_pi)
po = physics.PhysObject(500, 250, masse_po)
pi.ch_pas(pas)
po.ch_pas(pas)

#definition des forces
f_elas = physics.ForceElastique(pi, po, Lo, k)
f_elas2 = physics.ForceElastique(po, pi, Lo, k)
#application des forces
pi.addforce(f_elas, True)
po.addforce(f_elas2, True)

#vitesse initiale
pi.posx_ = 601