Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

i made an applet! two classes

Name: faggot mcwhorenut 2007-07-09 10:24 ID:7VWjQAC1


import java.awt.*;
import java.applet.*;

public class grid extends Applet
{
    private interpreter test;
   
    public void init()
    {
        test = new interpreter(12,448,32);
    //    test = new interpreter(10,224,16);
    //    test = new interpreter();
    }

    public void paint(Graphics g)
    {
        int X = 0;
        int Y = 0;
       
        int[] map2 = new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,0,6,6,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,1,1,1,9,9,9,9,0,6,0,0,0,0,6,0,0,1,1,1,0,0,0,0,0,0,0,0,0,9,9,9,9,1,1,1,1,9,9,9,0,0,0,2,3,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,9,9,9,1,1,1,1,1,1,9,9,0,0,0,4,5,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,9,9,9,1,1,1,1,1,1,1,9,9,0,6,0,0,0,0,6,0,0,2,2,2,0,0,0,0,0,0,9,9,9,9,9,1,1,1,1,1,1,1,1,9,0,6,6,0,0,6,6,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,1,1,1,1,1,1,1,1,1,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,1,1,1,1,1,1,1,1,1,1,9,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,1,1,1,1,1,1,1,1,1,1,9,0,9,9,9,9,9,0,0,3,3,0,0,0,0,0,0,9,9,9,9,9,1,1,1,1,1,1,1,1,1,9,9,0,9,9,9,9,9,9,0,3,3,0,0,0,0,0,9,9,9,9,9,9,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,3,3,9,9,9,9,9,9,9,9,9,9,9,9,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,3,3,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9};
        int[] map = new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,0,6,6,0,0,1,1,1,1,0,0,0,0,6,0,0,0,0,6,0,1,1,1,1,1,1,0,0,0,0,0,2,3,0,0,0,0,2,2,2,2,0,0,0,0,0,0,4,5,0,0,0,0,2,2,2,2,0,0,0,0,6,0,0,0,0,6,0,0,2,2,2,2,0,0,0,0,6,6,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,0,0,3,3,0,0,0,0,0,0,0,9,9,9,9,9,9,0,3,3,0,0,0,0,0,9,0,0,9,9,9,9,9,9,3,3,9,9,9,9,9,9,0,0,9,9,9,9,9,9,3,3,9,9,9,9,9,9,0,9,9,9,9,9,9,9,3,3,9,9,9,9,9,9};
        int[] field = new int[] {0,0,0,0,0,0,0,0,0,6,6,0,0,6,6,0,0,6,0,0,0,0,6,0,0,0,0,2,3,0,0,0,0,0,0,4,5,0,0,0,0,6,0,0,0,0,6,0,0,6,6,0,0,6,6,0,0,0,0,0,0,0,0,0};
       
        test.interpret(map2,g);
    }
   
}

//
//
//
// below this is another class
//
//
//

import java.awt.*;
import java.lang.String;

public class interpreter
{
   
    private int distance;
    private int tilesize;
    private int mapsize;
    private int TOP;
    private int MID;
    private Color tiletype;

    public interpreter ()
    {
        distance = 8;
        tilesize = 20;
        mapsize = 64;
        TOP = 40;
        MID = 60;
    }
   
    public interpreter (int tile, int map, int horizontal)
    {
        distance = horizontal;
        tilesize = tile;
        mapsize = map;
        TOP = tile * 2;
        MID = tile * 3;
    }

    public void interpret(int[] work, Graphics page)
    {
        int MIDreset = MID;
        int a = 0;
        int tcount = 0;
        while(a != mapsize)
        {
            if (work[a] == 0)
            {
                page.setColor (Color.green);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 1)
            {
                page.setColor (Color.lightGray);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 2)
            {
                page.setColor (Color.orange);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 3)
            {
                page.setColor (Color.red);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 4)
            {
                page.setColor (Color.pink);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 5)
            {
                page.setColor (Color.magenta);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            if (work[a] == 6)
            {
                page.setColor (Color.darkGray);
                page.fillRect (MID, TOP, tilesize,tilesize);
            }
            else
            page.setColor (Color.blue);
            page.fillRect (MID, TOP, tilesize,tilesize);
           
            a = a + 1;
            tcount = tcount + 1;
            MID = MID + tilesize;
           
            if (tcount == distance)
            {
                tcount = 0;
                TOP = TOP + tilesize;
                MID = MIDreset;
            }
        }   
    }           
}

Name: Anonymous 2007-07-09 10:37 ID:Heaven

resources go in external files

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List