Subscribe to extremeblueness' Blog        RSS Feed
-----

RPGs

Icon Leave Comment

Poll: RPGs (1 member(s) have cast votes)

Which do you like best for my text only RPG?

  1. Solar Flare (0 votes [0%])

    Percentage of vote: 0%

  2. Earthquake (0 votes [0%])

    Percentage of vote: 0%

  3. Comet (1 votes [100%])

    Percentage of vote: 100%

Vote Guests cannot vote
I'm making two RPGs! One text-only and one JApplet based.

The first one is gonna be a spin off the whole end of the world thing (which isn't really gonna happen) on December 21 for my final project in high school Basic Programming. I'm gonna use classes for the main menu (separate from the game itself because the main menu uses Strings for input and the game itself only uses char), the game itself, the end, and a class called Directions. This last class is because I'm gonna have the ground itself move instead of the character, giving each piece of ground a copy of the variables (x and y) inside Directions. Its either gonna start with a solar flare (in which case the final boss would be Soul of Sol), an earthquake (in which case the final boss would be Terreminator), or a comet (in which case the final boss would be Frost Bite). The reason its text only is because my programming teacher forbade using GUI for it.

The second one is gonna be a christmas gift for my sister. Its gonna be where you have to save Christmas. I don't quite know the plot yet. I was finally able to implement user input for this one with a little help from the awesome people here at D.I.C.

Here's the code so far for the applet one:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
<applet code="SaveChristmas" width=300 height=50>
</applet>
*/

public class SaveChristmas extends JApplet implements Runnable, KeyListener
{
    boolean pause;
    char ch = 0;
    Thread t;
    String s = "HW";
    
    public void init()
    {
        t = null;
        addKeyListener(this);
    }
    
    public void start()
    {
        t = new Thread(this);
        pause = false;
        setFocusable(true);
        t.start();
    }
    
    public void run()
    {
        for( ; ; )
        {
            try
            {
                repaint();
                Thread.sleep(20);
                if(pause)
                    break;
            }
            catch(InterruptedException exc) {}
        }
    }
    
    public void stop()
    {
        pause = true;
        setFocusable(false);
        t = null;
    }
    
    public void keyTyped(KeyEvent e)
    {
        try
        {
            ch = e.getKeyChar();
            Thread.sleep(20);
            //run();
        }
        catch(InterruptedException exc) {}
    }
    
    @Override
    public void keyPressed(KeyEvent e)
    {
    }
    
    @Override
    public void keyReleased(KeyEvent e)
    {
    }
    
    public void paint(Graphics g)
    {
        if(ch == 'c')
            g.drawString(s, 50, 50);
    }
}


I can't provide sample code yet for the other one, because its at school. I'll try to get some on here by tomorrow (hopefully I can find my flash drive).

0 Comments On This Entry

 

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

October 2014

S M T W T F S
    1 234
567891011
12131415161718
19202122232425
262728293031 

Tags

    Recent Entries

    Recent Comments

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)

    Categories