Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

262 Neutral

About PsionicTransvection

  • Rank
  1. So here is the thing I`m working on a small game which it looks like this there are 2 tanks shooting at each other in turns and you are supposed to change the angle (moving arrow up or arrow down) and the power with which the projectile is flying (holding down the space the longer you hold the more power the projectile gets). So far managed to make a small figure moving around the screen and shooting but until this point I made it shoot only in a straight line searched a lot of links and videos about this problem I found the formulas needed for calculating the curve but still have problems applying it in my code :/ I`m open to any suggestions or criticisms I`m sure I`m doing something wrong all advices and code examples will be gladly appreciated looking forward for your posts I really need help with the parabola problem . Here is the shoot method which makes the projectile move it`s a rectangle : (sorry for not putting the code in tags for some reason when I do it does not print the whole code) public void shoot() { if (shot) { bullet.x -= 5; bullet.y--; System.out.println(bullet.y); if (bullet.x <= 0) { readyToFire = true; System.out.println("Boom"); boom = true; //power = 0; } } } I also attached a rar with the whole code so far it`s only 2 classes it`s not much
  2. PsionicTransvection

    Moving an image

    import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; public class View extends JFrame implements KeyListener { JPanel jp = new JPanel(); JLabel jl1 = new JLabel(); ImageIcon img = new ImageIcon(getClass() .getResource("/images/Standing.png")); static int Xposition = 0; static int Yposition = 300; public View() { setTitle("GG"); setSize(800, 600); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); jp.setLayout(null); setLocationRelativeTo(null); jl1.setIcon(img); jp.add(jl1); jl1.setBounds(Xposition, Yposition, jl1.getIcon().getIconWidth(), jl1 .getIcon().getIconHeight()); add(jp); validate(); } public static void main(String[] args) { View view = new View(); } @Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } } once I have loaded an image into the JFrame how can I make it move with the arrow keys I saw some tutorials how to do it if you draw a figure yourself but how to do with an actual image you have loaded ?
  3. PsionicTransvection

    Problem with JAVA ImageIcon

    fixed it had to import the images through Eclipse omg
  4. PsionicTransvection

    Problem with JAVA ImageIcon

    any other ideas ?
  5. PsionicTransvection

    Problem with JAVA ImageIcon

    same thing
  6. PsionicTransvection

    Problem with JAVA ImageIcon

    same exception different line in another program I have done the assignment the same way outside the constructor checked path everything still getting the NullPointerException
  7. PsionicTransvection

    Problem with JAVA ImageIcon

    import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class View extends JFrame { JPanel jp = new JPanel(); JLabel jl1 = new JLabel(); ImageIcon figure = new ImageIcon(getClass().getResource("/blank.png")); // I get the exception here public View(){ setTitle("test"); setSize(800, 600); setResizable(false); setVisible(true); setLocationRelativeTo(null); jl1.setIcon(figure); jp.add(jl1); add(jp); jl1.setBounds(0, 0, jl1.getIcon().getIconWidth(), jl1.getIcon() .getIconHeight()); validate(); } public static void main(String[] args){ new View(); } } for some reason I can`t fetch the image and the path and name is correct checked it several times and the funny thing is I`m doing it by checking some old code of mine and there is working perfectly ... This is the exception I get any Ideas ? Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:167) at View.<init>(View.java:14) at View.main(View.java:30)
  8. PsionicTransvection

    OpenGL vs DirectX ?

    Could you tell me which one is better to use ?
  9. PsionicTransvection

    Modeling and coding

    thank you for shedding some light on mu incompetence can you suggest me some more reading about it or give a some very simple example e.g. some chunk of code
  10. PsionicTransvection

    Modeling and coding

    So my question is when you make some 3D model or some 3D animation on let`s say 3D studio max and after that when you export it or something how do you actually connect it the source code of the game ?
  11. PsionicTransvection


    I just have a question about the UDK. Is it considered an industry standard of some sort ? Are there companies making games entirely on UDK or they are just using the Unreal engine sorry for the relatively stupid question but I`m curious.
  12. PsionicTransvection

    Math and 2D game development

    can you guys give me a simple example a chunk of code for what complex numbers can be used ?
  13. PsionicTransvection

    Math and 2D game development

    Yeah I know that video game development is not easy at all but I have to start from somewhere
  14. PsionicTransvection

    Math and 2D game development

    Hello there sorry for the silly question but I prefer some advices than just going ahead. Recently I started learning how to make simple 2D games. First one I made was tic tac toe and then I started working on pong but it`s not finished yet. I`m pretty much aware that math is quite an important part of video game development and I just want to ask you guys which branches of mathematics are the most vital ones when it comes to 2D game development .. Let`s say for example a simple side scrolling game with a very basic physics engine. And what math/physics will it be required in order to . let`s say make it smoother and with better physics , sorry again for the lame question it`s just I feel quite confused atm.Really looking forward to your replies !
  15. I wrote a class that is suppose to draw a red rectangle in a JPanel with and the background of the panel is suppose to be black here is my code import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; import java.awt.Graphics; public class View extends JFrame { private JPanel panel = new JPanel(); public void paint(Graphics g) { g.setColor(Color.RED); g.drawRect(20, 50, 100, 100); } public View() { setSize(640, 480); setResizable(true); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setBackground(Color.BLACK); panel.setSize(640, 480); panel.setBackground(Color.BLACK); panel.paint(null); this.add(panel); } public static void main(String[] args) { View view = new View(); } } and here is what I get as a result there appears to be some glitch in the background [attachment=7847:WTF.PNG] (this is a screen of the gui from my code not a minimized Eclipse) and here is how it is without the paint method it does as it suppose to making a window with a black background [attachment=7848:without paint method.PNG] Is it something wrong with my code that it does like that or there is something wrong with my computer ?
  • 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!