U3F1ZWV6ZTE4Njk5NTM2MjU3MDQwX0ZyZWUxMTc5NzI4NDQzNTgwOQ==

Programing games using java 2


الدرس الثاني من تصميم لعبة سوبر مايو 

 .السلام عيكم اليوم سنستمر في بناء لعبة سوبر ماريو باستخدام لغة جافا

. في هذا الفيديو ، سنضيف الخلفية إلى اللعبة ونجعل سوبر ماريو في وصع البداية 

أولا

. يجب إضافة الصورتين في مجلد الصور ثم دعوتهم باستخدام أكواد جافا 

Images كل عمل اليوم في كلاس  .ومجلد 

. أي شيء شرحته في الفيديو بمزيد من التفاصيل

. من فضلك شاهد الفيديو ولا تنسى الاشتراك و اعجب بالفيديو و مشاركة هذا مع اصدقائك



. هذه خلفية الصورة لتضيفها في مشروعك



 . وهذه صورة سوبر ماريو



. هذا هو الكود في الفيديو الثاني

package websit.supermario;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class Scene extends JPanel {

private ImageIcon icoFond;
private Image imgFond1;


private ImageIcon icoMario; 
private Image imgMario; 
private int xFond1;


private int xdx;
public Scene(){
super();
this.xFond1 = -50;

this.xdx = 0;
icoFond = new ImageIcon(getClass().getResource("/images/fondEcran.png"));
this.imgFond1 = this.icoFond.getImage();


icoMario = new ImageIcon(getClass().getResource("/images/marioMarcheDroite.png"));
this.imgMario = this.icoMario.getImage();
this.setFocusable(true);
this.requestFocusInWindow();
this.addKeyListener(new Clavier());
Thread chronoEcran = new Thread(new Chrono());
chronoEcran.start();
}
public int setXdx() {return xdx;}
public void setXdx(int dx) {this.xdx = dx;}
public void deplacementFond()
{this.xFond1 = this.xFond1 - this.xdx;
}


public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics g2 = (Graphics2D)g;
this.deplacementFond();
g2.drawImage(this.imgFond1, this.xFond1, 0, null); // Dessin de l'image de fond 


  g2.drawImage(imgMario, 300, 245, null); //*** code provisoire
}
}



. شكرا لك على مشاهدة هذا الفيديو

إذا كان لديك أي سؤال ، فاكتب تعليقًا هنا أسفل الفيديو 


***********************


***********************

تعليقات
تعليق واحد
إرسال تعليق

إرسال تعليق

الاسمبريد إلكترونيرسالة