Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nemo

Pages: [1] 2 3 ... 82
1
Axe / Re: Math help for game
« on: November 13, 2011, 05:34:59 pm »
you can never write too much when describing something. however, finding the angle of the ball is only that easy if the ball is falling from straight down, but looking at your game the ball isn't going to always fall straight down. unfortunately, i'm not sure how to calculate the angle.

according to this code, to rotate the the line about the point you would have something like this:

Code: [Select]
//point of rotation is always (48, 32) (the center of the screen)
//the line is described as (X1,Y1) (X2,Y2)
//Z is the angle of rotation... however Axe represents it. binary degrees?
//A,B,C,D are all temp vars
X1-48->A
Y1-32->B
X2-48->C
Y1-32->D
48-(Acos(Z)-(Bsin(Z))->X1
32-(Asin(Z)-(Bcos(Z))->Y1
48-(Ccos(Z)-(Dsin(Z))->X2
32-(Csin(Z)-(Dcos(Z))->Y2

of course, i'm taking his word for it. i didn't actually do the math.

2
Axe / Re: Math help for game
« on: November 13, 2011, 05:05:49 pm »
the equation for the line is Y=(B1-B2)/(A1-A2)*(X-A1)+B1 (this is point-slope form) so to find if a certain point (X,Y) is on that line, plug in X and see if you get Y.

to find angle C, find angle D and add 90°. angle D is calculated most easily by doing Tan-1((Y-B1)/(X-A1))

3
Other Calc-Related Projects and Ideas / Re: Builderboy's RTS Design
« on: November 09, 2011, 06:53:47 pm »
shouldn't the stationary turret be a building, not a unit, since it can't move? also, i'm interested in making a game like this to simulate and test out different game elements, albeit in java and not on a calculator

4
Computer Programming / Re: Natural Language Processing
« on: November 05, 2011, 11:37:03 pm »
what's your end goal? to be able to ask your program a question and have it come up with a logical answer, or have it be able to break down the parts of a sentence i.e. sentences into clauses & phrases, clauses & phrases into individual parts of speech?

5
Casio Calculators / Re: Planète-Casio's Ludum Dare
« on: November 03, 2011, 07:50:35 pm »
sorry for the off topic, but was the choosing of this name because it means "a game to give" in latin? in my latin class i get extra credit for external references (besides obvious ones like money, planets, etc) so it would benefit for me to know. it looks nice too!

6
News / Re: Omnimaga introduces instant quick-reply and enhanced CODE tags
« on: November 01, 2011, 06:01:21 pm »
Spoiler For Spoiler:
Code: [Select]
let's
test
this

edit: it doesn't work

7
TI Z80 / Re: Zedd Physics Library (BETA)
« on: October 31, 2011, 01:35:35 am »
i've been going through the source code for this deciphering it trying to figure it all out, but i've hit a roadblock. In the SimZ function, what is the variable H used for? i think it's detecting if the object is moving horizontally, but i'm not sure.

8
TI Z80 / Re: Tokens
« on: September 28, 2011, 11:38:47 pm »
I'm not sure what the status of this project is, but would it be possible to have an option to use a monospaced font like Courier?

Edit: nevermind, Tokens uses the monospaced font Consolas, which i didn't have on my computer.

9
Computer Programming / Re: Java Panel/Frame has different sizes
« on: September 13, 2011, 07:54:07 pm »
do a System.out.println(getParent()); and System.out.println(mainFrame); and copy/paste the output

10
Computer Programming / Re: [Java] Timer inside event-based class
« on: September 04, 2011, 10:31:25 pm »
my approach would be to have an instance variable of javax.swing.Timer called timer in the Game class. then in the game constructor:

Code: [Select]
public Game(){
    //other stuff
    timer = new Timer([MILLISECONDS], new ActionListener(){
        public void actionPerformed(ActionEvent e){
            //run whatever functions you want.
        }});
    timer.start();
}

11
Computer Programming / Re: [Java] Adding graphics to frame
« on: August 19, 2011, 03:54:06 pm »
Again, you cannot add Graphics to the panel. JPanels have a Graphics instance variable already. i just noticed your method header for paintComponent is incorrect. it's parameter should be of type Graphics, not Graphics2D.

12
Computer Programming / Re: [Java] Adding graphics to frame
« on: August 18, 2011, 02:37:34 pm »
the exact some code is working on my computer. are you sure you saved/recompiled before you ran the code? also, what's the project you're working on?

13
Computer Programming / Re: [Java] Adding graphics to frame
« on: August 18, 2011, 02:23:55 pm »
yes, you aren't adding the game panel to the JFrame.

14
Computer Programming / Re: [Java] Adding graphics to frame
« on: August 18, 2011, 02:17:46 pm »
the Game class has a Graphics instance variable inherited from JPanel. you don't need to add it. you can access the graphics variable using paintComponent.

15
Computer Programming / Re: [Java] Adding graphics to frame
« on: August 18, 2011, 12:54:38 pm »
Graphics is also an abstract class, so that wouldn't work either. you can still split it into multiple files:

Code: ("Runner.java") [Select]
public class Runner{
    public static void main(String[] args){
        new Game().run();
    }
}
Code: ("Game.java") [Select]
public class Game extends JPanel{
    public Game(){
        //set up JFrame
    }
    public void run(){
        //show JFrame
    }
    public void paintComponent(Graphics g){
        //paint things here
    }
}

what are you making, by the way? if you're worried the paintComponent method will get too large because you have too many objects to draw e.g. you have an array of 100 enemies, your character, the background, the tilemap etc. just make an Enemy, Character, Tilemap class and have them each have a draw(Graphics) method.

Pages: [1] 2 3 ... 82