Premier commit

This commit is contained in:
Stève Oriol 2021-01-17 18:57:36 +01:00
commit ab519c206d
101 changed files with 16457 additions and 0 deletions

176
Boss.pde Normal file
View File

@ -0,0 +1,176 @@
boolean boss_d_ou_g = false;
int boss_bouge = 800;
int boss_y = 171;
int boss_vitesse = 8;
boolean collision_laser = false;
float boss_cooldown = 5;
float boss_time;
int boss_stop = 4;
int pv_baseboss = 1;
int boss_pv = pv_baseboss;
int Xa, Xb, Xc, Ya, Yb, Yc, Xd, Yd, Xe, Ye;
float time_game = millis()/1000;
float ABC, DBC, ACB, DCB, EBC, ECB;
int H_jpv = 25, W_jpv = 650, x_jpv, y_jpv = 20;
int largeur_bar_vie_T = W_jpv;
int largeur_bar_vie_cible = W_jpv;
boolean invincible = false, son_Laser = false, clignote = false;
int invisi_time = 1000; // temps de d'invincibilité en millisecondes (2 secondes)
int deta_time, time_inv_boss;
int deta_cligno_time = 150; // temps de clignotage en millisecondes
int time_cligno_boss;
void boss() {
time_game = millis()/1000;
println("second : "+ time_game);
println("boss_time + boss_cooldown : " + boss_time + boss_cooldown);
if (boss_time + boss_cooldown < time_game && !invincible){
boss_vitesse = 0;
image(laserboss1, boss_bouge, 380 + boss_y);
//joue le son du laser une seul fois
if(!son_Laser){
son_Laser = true;
sonLaser_boss.play();
}
//calcul dimension laser:
//coordonnées point haut
Xa = boss_bouge;
Ya = -100 + boss_y;
Xb = boss_bouge - 566;
Yb = -100 + boss_y + 981;
Xc = boss_bouge + 566;
Yc = Yb;
//triangle(Xa, Ya, Xb, Yb, Xc, Yc);
//coordonnées base du vaisseau:
Xd = x - 100;
Yd = y + 100;
Xe = x + 100;
Ye = Yd;
//calcul des angles
ABC = acos( ( ((Xc-Xb)*(Xa-Xb)) + ((Yc-Yb)*(Ya-Yb)) )/( sqrt(sq(Xc-Xb)+sq(Yc-Yb)) * sqrt(sq(Xa-Xb)+sq(Ya-Yb)) ) );
ACB = ABC;
//println("ABC : "+ ABC);
//DBC = acos( ( ((Xc-Xb)*(Xd-Xb)) + ((Yc-Yb)*(Yd-Yb)) )/( sqrt(sq(Xc-Xb)+sq(Yc-Yb)) * sqrt(sq(Xd-Xb)+sq(Yd-Yb)) ) );
DCB = acos( ( ((Xb-Xc)*(Xd-Xc)) + ((Yb-Yc)*(Yd-Yc)) )/( sqrt(sq(Xb-Xc)+sq(Yb-Yc)) * sqrt(sq(Xd-Xc)+sq(Yd-Yc)) ) );
EBC = acos( ( ((Xc-Xb)*(Xe-Xb)) + ((Yc-Yb)*(Ye-Yb)) )/( sqrt(sq(Xc-Xb)+sq(Yc-Yb)) * sqrt(sq(Xe-Xb)+sq(Ye-Yb)) ) );
//println("DCB : "+ DCB + " / EBC : "+ EBC);
//line(Xd, Yd, Xe, Ye);
//println("Xb, Xe : " + Xb + " <> " + Xe);
//test collisions avec le laser:
if (EBC > ABC || ACB < DCB) {
collision_laser = false;
} else {
collision_laser = true;
ship.collision = true;
println("collision : " + collision_laser);
}
// boucle fin d'attaque
if (boss_time + boss_cooldown + boss_stop < time_game){
boss_cooldown = random(1, 7);
boss_vitesse = 8;
boss_time = time_game;
son_Laser = false;
}
//println("boss_time + boss_cooldown + boss_stop : "+ boss_time + boss_cooldown + boss_stop);
}
if(!clignote){
image(imgboss1, boss_bouge, boss_y);
}
if (boss_d_ou_g == true){ //si le boss vas vers la gauche
if (boss_bouge > 0){ //si le boss il n'est pas tout a gauche
boss_bouge -= boss_vitesse; //on le fais aller a gauche
} else { //sinon
boss_d_ou_g = false; //on lui dit d'aller a gauche
}
}
if (boss_d_ou_g == false && boss_bouge < width){
boss_bouge += boss_vitesse;
} else {
boss_d_ou_g = true;
}
//largeur en pixels en fonction des pv courants du boss
largeur_bar_vie_cible = W_jpv * boss_pv / pv_baseboss;
println ("T : " + largeur_bar_vie_T + " C : " + largeur_bar_vie_cible);
if (time_inv_boss + deta_time <= millis()){
if (largeur_bar_vie_T > largeur_bar_vie_cible){
largeur_bar_vie_T -- ;
invincible = true;
} else {
invincible = false;
}
time_inv_boss = millis();
}
// clignotement :
if (invincible && time_cligno_boss + deta_cligno_time <= millis()) {
time_cligno_boss = millis();
clignote = !clignote;
} else if (!invincible) {
clignote = false;
}
//jauge des pv du boss
x_jpv = width/2-W_jpv/2;
fill(255, 255, 255, 40);
noStroke();
rect(x_jpv, y_jpv, W_jpv, H_jpv, H_jpv / 2);
fill(#AE0202, 230);
noStroke();
rect(
x_jpv + (W_jpv - largeur_bar_vie_T)/2, // coordonnées X de la bar de vie
y_jpv, // coordonnées Y de la bar de vie
largeur_bar_vie_T,
H_jpv, // hauteur de la bar de vie
H_jpv / 2 // pour arrondir les angles de la bar de vie du boss
);
fill(255);
textSize(H_jpv / 1.5);
textAlign(CENTER, CENTER);
text(boss_pv + " / " + pv_baseboss , x_jpv + W_jpv / 2 , y_jpv + H_jpv /2);
textAlign(LEFT, BOTTOM);
textSize(12);
strokeWeight(2);
stroke(#ffffff);
noFill();
rect(x_jpv, y_jpv, W_jpv, H_jpv, H_jpv / 2);
fill(255, 255, 255);
strokeWeight(1);
stroke(#000000);
if ( dist(ship.x, ship.y, boss_bouge, boss_y) < 200 ) {
// en gros le vaisseau éclate quand il touche le boss
ship.collision = true;
} else {
//si le missile est en contact avec le boss et qu'il n'est pas invincible le boss perd un point de vie
if ( dist(xm, ym, boss_bouge, boss_y) < 114 && !invincible ){
boss_pv = boss_pv - 1;
sonCollision.play();
time_inv_boss = time_cligno_boss = millis();
//calcul delai en miliseconds pour chaque pixels a supprimer de la bars de vie en fonction du temps d'invincibilité du boss
// temps / pixels a suprimmer de la barre :
deta_time = invisi_time / (W_jpv - (W_jpv * boss_pv / pv_baseboss));
//println("boss_pv : " + boss_pv + " :: deta_time : " + deta_time);
lancermisile = false;
clignote = false;
}
}
}

63
Misile.pde Normal file
View File

@ -0,0 +1,63 @@
//code des Misiles des méchants
class Misile {
boolean show = false;
PImage misile;
int y,x,yStart;
float time;
Misile(int xt,int yt,String misilet,float timet) {
x = xt;
y = yStart = yt;
time = timet;
misile = loadImage(misilet);
}
void apparaitre() {
image(misile, x, y);
}
void verifiercollisions() {
// Si un missile est en cours
if (show) {
// Si le missile sort en bas de l'écran
if (y > hauteur) {
//on supprime le missile
show = false;
//on remet le y du missile pour le prochain
y = yStart;
}
if ( dist(ship.x, ship.y, x, y) < 130 ) {
// Averti le vaiseau de la collision avec le missile
ship.collision = true;
sonCollision.play();
// supprime le missile
show = false;
}
}
}
void tomber() {
y += 10;
}
void affiche_et_mets_a_jour_le_missile() {
if (show) {
tomber();
verifiercollisions();
apparaitre();
} else {
//Si pas de missile actif on peut en lancer un de temps en temps si le ship et toujours en vie:
// 0.1% du temps
if ( ship.pv != 0 && random(1000) < 1 ) show = true;
}
}
}

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Premier jeux de Arthaud avec Processing
https://processing.org/
liens utiles:
- https://processing.org/examples/loadsavetable.html
- https://processing.org/examples/loadsavejson.html
- https://processing.org/examples/arraylistclass.html
- https://processing.org/examples/arraylistclass.html
- https://processing.org/tutorials/arrays/
- https://processing.org/examples/arrayobjects.html
- https://processing.org/examples/movingoncurves.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

2
SRC/Info.txt Normal file
View File

@ -0,0 +1,2 @@
Pour utiliser "Shéma angle.json" aller sur https://excalidraw.com/

12141
SRC/Item de jeu.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 907 KiB

3513
SRC/Shéma angle.json Normal file

File diff suppressed because it is too large Load Diff

38
SRC/Sons.aup Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="Sons_data" version="1.3.0" audacityversion="2.1.2" sel0="0.6269387755" sel1="0.8939682540" vpos="0" h="0.0000000000" zoom="86.1328125000" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Piste audio" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="0" rate="44100" gain="1.0" pan="0.0">
<waveclip offset="0.00000000">
<sequence maxsamples="262144" sampleformat="262159" numsamples="150992">
<waveblock start="0">
<simpleblockfile filename="e00004a4.au" len="150992" min="-0.178552" max="0.197785" rms="0.004264"/>
</waveblock>
</sequence>
<envelope numpoints="1">
<controlpoint t="3.423832199546" val="1.000000000000"/>
</envelope>
</waveclip>
<waveclip offset="3.42385488">
<sequence maxsamples="262144" sampleformat="262159" numsamples="14283">
<waveblock start="0">
<simpleblockfile filename="e0000c46.au" len="14283" min="-0.0" max="0.0" rms="0.0"/>
</waveblock>
</sequence>
<envelope numpoints="2">
<controlpoint t="0.000000000000" val="1.000000000000"/>
<controlpoint t="0.323854875283" val="1.000000000000"/>
</envelope>
</waveclip>
<waveclip offset="3.74773243">
<sequence maxsamples="262144" sampleformat="262159" numsamples="175205">
<waveblock start="0">
<simpleblockfile filename="e000035d.au" len="175205" min="-1.00654" max="1.012301" rms="0.148232"/>
</waveblock>
</sequence>
<envelope numpoints="1">
<controlpoint t="0.000000000000" val="1.000000000000"/>
</envelope>
</waveclip>
</wavetrack>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SRC/images.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
SRC/mechant_SRC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

BIN
SRC/misile_SRC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
SRC/redfighter0005_SRC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
SRC/vaiseau_enemi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

73
Ship.pde Normal file
View File

@ -0,0 +1,73 @@
//ceci est TOUT le code qui concerne un Ship
class Ship {
int x,y,pv;
PImage ship_explo;
boolean show;
boolean collision = false;
int NUMEROXEPLO = 0;
Ship(int xt,int yt, int pvt, PImage imaget){
x = xt;
y = yt;
ship_explo = imaget;
show = true;
pv = pvt;
}
void apparaitre() {
//affiche l'anime de explosion :
if ( !show && NUMEROXEPLO<50 ) {
// Ou Methode avec un if :
if ( String.valueOf(NUMEROXEPLO).length()==1 ) ship_explo = loadImage("data/images/explosion/explosion000"+NUMEROXEPLO+".png");
else ship_explo = loadImage("data/images/explosion/explosion00"+NUMEROXEPLO+".png");
NUMEROXEPLO += 1;
}
if (NUMEROXEPLO == 1 && son) sonExposion.play();
//Affiche le ship ou explosion s'il n'est pas détruis (l'anime de explosion est pas finie)
if (NUMEROXEPLO < 50) image(ship_explo, x, y);
}
void set_position(int xn,int yn) {
if (show) {
x = xn;
y = yn;
}
}
void verifiercollisions() {
// avec un mechant:
if (collision) {
// on luis enleve un point de vie
pv = pv - 1;
collision = false;
//le vaiseau disparait si il a plus de vie :
if ( pv == 0 ) {
show = false;
}
}
}
void affiche_et_mets_a_jour_le_ship(int xn,int yn) {
if (show) {
set_position(xn,yn);
verifiercollisions();
}
//Jusqu'à la fin de l'animation de l'explosion
apparaitre();
}
}

BIN
data/3DLETBRK-48.vlw Normal file

Binary file not shown.

BIN
data/images/Thumbs.db Normal file

Binary file not shown.

BIN
data/images/Win_game.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
data/images/gameover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
data/images/laser_boss1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
data/images/misile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
data/images/space.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
data/sons/Laser_boss.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/sons/SF-gun2.mp3 Normal file

Binary file not shown.

BIN
data/sons/SFB-arm2.mp3 Normal file

Binary file not shown.

BIN
data/sons/SFB-arme.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/sons/SFB-rocket.mp3 Normal file

Binary file not shown.

BIN
data/sons/Vol.mp3 Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,29 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="demo-explosion-debris-07_data" version="1.3.0" audacityversion="2.2.1" sel0="2.2738645852" sel1="2.2738645852" vpos="0" h="0.0000000000" zoom="465.2871621622" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + millisecondes" frequencyformat="Hz" bandwidthformat="octaves">
<tags>
<tag name="ARTIST" value="Arthaud"/>
<tag name="GENRE" value="Ambient"/>
<tag name="TITLE" value="Quand ton vaisseau passe un sale quart-d&apos;heure"/>
</tags>
<wavetrack name="demo-explosion-debris-07" channel="0" linked="1" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="86440">
<waveblock start="0">
<simpleblockfile filename="e0000fa5.au" len="86440" min="-0.937189" max="0.989144" rms="0.307664"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="demo-explosion-debris-07" channel="1" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="86440">
<waveblock start="0">
<simpleblockfile filename="e0000087.au" len="86440" min="-0.920737" max="1.000718" rms="0.282953"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>

Binary file not shown.

BIN
data/sons/lancemissile.mp3 Normal file

Binary file not shown.

BIN
data/sons/sf_canon_01.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

89
mechant.pde Normal file
View File

@ -0,0 +1,89 @@
//ça c'est TOUT le code qui dit ce que c'est un enemy
class Alien {
int x,y,enemypv;
PImage enemy_explo;
boolean show;
float time;
int NUMEROXEPLO = 0;
Alien(int xt,int yt,int pv, PImage enemyt /*float timet*/){
x = xt;
y = yt;
enemy_explo = enemyt;
show = true;
enemypv = pv;
/*time = timet;*/
}
void apparaitre() {
//affiche l'anime de explosion :
if ( !show && NUMEROXEPLO<50 ) {
//// Methode avec calcul du nombre de zeros:
//// 4 - le nb de carateres de l'entier NUMEROXEPLO [4 correspond au nb de zero du nom des fichiers]
//int nbCarateres = String.valueOf(NUMEROXEPLO).length();
//int nbZeros = 4 - nbCarateres;
//String chainDeZero = new String(new char[nbZeros]).replace("\0", "0");
//enemy = loadImage("images/explosion/explosion"+chainDeZero+NUMEROXEPLO+".png");
// Ou Methode avec un if :
if ( String.valueOf(NUMEROXEPLO).length()==1 ) enemy_explo = loadImage("data/images/explosion/explosion000"+NUMEROXEPLO+".png");
else enemy_explo = loadImage("data/images/explosion/explosion00"+NUMEROXEPLO+".png");
NUMEROXEPLO += 1;
}
if (NUMEROXEPLO == 1 && son) {
sonExposion.play();
nombreEnemiReste -= 1;
}
//Affiche le mechant ou explosion s'il n'est pas détruis (l'anime de explosion est pas finie)
if (NUMEROXEPLO < 50) image(enemy_explo, x, y);
}
void verifiercollisions() {
// Avec le missile
if ( show && !( xm < x-40 || xm > x+40 ) && ym < y) {
// on luis enleve un point de vie
enemypv = enemypv - 1;
y = y - 20;
//suprime le missile
lancermisile = false;
}
// Avec le ship
// DEBUG : Affiche x et y dans la console
//println(dist(ship.x, ship.y, x, y) + "ship.x : " + ship.x + " < " + (x-75) + " : > " + (x+75) + " ship.y : " + ship.y + " <> " +y);
if ( dist(ship.x, ship.y, x, y) < 130 ) {
// Averti le vaiseau de la collision
ship.collision = true;
// on luis enleve un point de vie
enemypv = enemypv - 1;
y = y - 20;
}
//le mechant disparait si il a plus de vie :
if ( enemypv == 0 ) {
show = false;
}
}
void affiche_et_mets_a_jour_les_mechants() {
verifiercollisions();
apparaitre();
}
}

Some files were not shown because too many files have changed in this diff Show More