Jump to content
  • Advertisement

Simla

Member
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

117 Neutral

About Simla

  • Rank
    Newbie

Personal Information

  • Role
    Game Trailers
  • Interests
    Art
    Education
    Production
    Programming

Recent Profile Visitors

828 profile views
  1. Simla

    my character does not move

    it was done in this way. Thank you for your helping.
  2. Simla

    my character does not move

    public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if(c == KeyEvent.VK_LEFT){ if(marioX <=0){ marioX = 0; } else{ marioX -= XMario; } } else if(c==KeyEvent.VK_RIGHT){ if(marioX >=1000){ marioX = 1000; } else{ marioX += XMario; } } } I move when I remove the 'if else', but this time I do not check whether the character goes out of the screen.
  3. Simla

    my character does not move

    I am programming a game. I have just begun to learn English yet, I may have misread it. import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.imageio.stream.FileImageInputStream; import javax.swing.JPanel; import javax.swing.Timer; class Ates{ private int x; private int y; public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public int getX() { return x; } public int getY() { return y; } public Ates(int x, int y) { this.x = x; this.y = y; } } public class Oyun extends JPanel implements KeyListener,ActionListener { Timer timer = new Timer(5, this); private int gecenSure=0; private BufferedImage image; private ArrayList<Ates> atesler = new ArrayList<Ates>(); //ateş etme aktif olduğu zaman x ekseninde hareket etmesini sağlayacak değişken private int atesEtX = 1; private int düsman = 0; private int düsmanHareket = 2; //Marionun nereden başalayacağınnı belirliyoruz private int marioX = 0; //Sola veya sağa bastığımz zaman hareket etmesini sağlayacak private int XMario = 20; public Oyun() throws IOException { try{ //Yukarıda tanımladığımız image değişkenine png dosyasını atıyoruz. image = ImageIO.read(new FileImageInputStream(new File ("up.png"))); } catch(IOException ex){ Logger.getLogger(Oyun.class.getName()).log(Level.SEVERE, null, ex); } setBackground(Color.DARK_GRAY); timer.start(); } @Override public void repaint() { super.repaint(); } @Override public void paint(Graphics g) { super.paint(g); g.setColor(Color.MAGENTA); g.fillOval(düsman, 0, 20, 20);//topun büyüklüğü //Oluşturduğumuz karakterin konumunu ve boyutunu ayarladık g.drawImage(image, marioX, 500, image.getWidth()*2, image.getHeight()*2,this); } @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if(c == KeyEvent.VK_LEFT){ if(marioX <=0){ marioX = 0; } else{ marioX -= XMario; } } else if(c==KeyEvent.VK_RIGHT){ if(marioX >=1000){ marioX = 1000; } else{ marioX += XMario; } } } @Override public void keyReleased(KeyEvent e) { } //Düşmanı hareket ettirmek için @Override public void actionPerformed(ActionEvent e) { } } ------------------------------------------------------------------------- import java.awt.HeadlessException; import java.io.IOException; import javax.swing.JFrame; public class OyunEkrani extends JFrame { public OyunEkrani(String title) throws HeadlessException { super(title); } public static void main(String [] args) throws IOException{ OyunEkrani oe = new OyunEkrani("Super Mario"); oe.setResizable(false); oe.setFocusable(false); oe.setSize(1000, 700); oe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Aşağıdki klavye işlemleri ile ilgili olan kodların sıralamaları önemli. Yreleri değiştiğinde çalışmayabilir. Oyun oyun = new Oyun(); //fokusu isitiyoruz oyun.requestFocus(); //klavyeden yapılan ilemleri anlamak için lullanıyoruz oyun.addKeyListener(oyun); //Odağı JFrame üzerinden çektik ve Jpanel üzerine verdik. oyun.setFocusable(true); //klavye işlemlerini anlayabilmesi için false yaptık oyun.setFocusTraversalKeysEnabled(false); oe.add(oyun); oe.setVisible(true); } }
  4. I'm programing a game with mario in Java. When I run the code, it does not give an error, but the character does not move. I checked every bit but I could not find the error. I left the codes down. What should I do? Oyun.class OyunEkrani.class
  5. Simla

    advance enemy

    I did that later on Update () but it does not work
  6. Simla

    advance enemy

    I am playing Unity 2D, I wrote the following code to advance the enemy, but when I play the game the enemy does not advance or even disappears using System.Collections; using System.Collections.Generic; using UnityEngine; public class Dusman : MonoBehaviour { public Transform hedef; void Start () { hedef = GameObject.FindGameObjectWithTag("Player").transform; } void FUpdate() { transform.LookAt(hedef); transform.position += transform.forward * 2 * Time.deltaTime; } }
  7. I have a car object I wrote the codes in the picture to move it but it does not move I can not find anything about it on the internet what do I do
  8. Simla

    game design

    I am preparing a project for the school and I want to make a 2d game where to start
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!