DebateFort - Where Warriors Come To Debate
RAGECRY - Funny, Amusing, Interesting, Trending & Viral Videos and Images
GameOrc - Free Flash Games Online
Results 1 to 2 of 2
  1. #1
    Advanced Member
    MPGH Member
    pwnagebeef's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    151
    Reputation
    10
    Thanks
    19
    My Mood
    Relaxed

    need help with moving objects

    well i've been assigned to make a simple java game but im already having trouble .. i need to get something to move across the screen. I'm trying to get a rectangle to go across the top portion of the application. ofc I've youtubed and everything but i still get this smudge across the top of the screen when i do the fillRet ; when i do drawRect i get a bunch of lines spaced across. In case your curious of what im trying to make, i will be attempting to make a game sorta like fruit ninja. Much much simpler of course. Currently i just need to get an object to move :L Once i do that ill add pictures mouse stuff etc..Here's the code.

    Code:
    package gameapplication;
    
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import javax.swing.Timer;
    
    
    
    @Sup
    pressWarnings("serial")
    public class gameapp1 extends JFrame implements ActionListener{
    Timer tm = new Timer(5,this);
    int x =0, velX=2;
    
        public gameapp1 (){
            setSize(800,850);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setResizable(true);        
            setVisible(true);
            
            
              }
        
        public void paint(Graphics g){
           
           
        g.setColor(Color.RED);
        g.drawRect(x, 57, 90, 30);
        
        tm.start();
        
        }
        
        public void actionPerformed(ActionEvent e){
        x = x + velX;
        repaint();}
    public static void main(String[] args) {
        gameapp1 gm = new gameapp1();
        
        
    }}

  2. #2
    Threadstarter
    Advanced Member
    MPGH Member
    pwnagebeef's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    151
    Reputation
    10
    Thanks
    19
    My Mood
    Relaxed
    nvm i solved it

Similar Threads

  1. [Help Request] Need Help With A.V.A Error
    By ch1025 in forum Alliance of Valiant Arms (AVA) Help
    Replies: 7
    Last Post: 05-14-2011, 09:15 AM
  2. [Help Request] Need help with making binds !
    By JonathanTBM in forum Vindictus Help
    Replies: 4
    Last Post: 05-10-2011, 07:40 PM
  3. [Help Request] Need help with numpad while recording macro !
    By JonathanTBM in forum Vindictus Help
    Replies: 2
    Last Post: 05-10-2011, 07:37 PM
  4. [Help Request] need help with mod
    By .:MUS1CFR34K:. in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 4
    Last Post: 05-01-2011, 12:40 PM
  5. [Help Request] need help with modding
    By BayBee Alyn in forum Combat Arms Help
    Replies: 0
    Last Post: 04-27-2011, 09:06 PM