top of page

PImage img;  // Declare variable "a" of type PImage
void setup()
{
size(640, 360);
frameRate(30);
xpos = 600;
ypos = 0;
 img = loadImage("tux.png");  // Load the image into the program
 
}
void draw()
{
  imageSize=imageSize-0.1;
background(#FF12E8);
// Update the position of the shape
xpos = xpos -2;
ypos = ypos +0.9;
// Displays the image at its actual size at point (0,0)
  image(img, -340,-200, img.width/2, img.height/2);
 
  image( img, xpos, ypos, img.width/imageSize, img.height/imageSize);
  if (xpos < 50) { textSize(20); text("Le terroriste est passé", 200,200);}
    if (xpos < 0) { xpos =600; ypos = 0; imageSize= 40;}
}

 

Ce programme permet de faire se déplacer une image sur un fond, celle-ci se déplace en diagonale (de en haut à droite jusqu'en bas à gauche). Cette image s'agrandit le long de son trajet. A la fin de l'animation, un mesage apparait: "le terroriste est passé".

Ce programme nous a servi d'initiation; il nous aidera dans la création de notre jeu.

© 2023 by Name of Site. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page