Saturday, 19 July 2014

Java - Relocate portion of a large image based on the location of a layered image (please help)



How would you draw part of a large image inside a JLayeredPane. Large Image size = 2000 x 2000 pix as JLayeredPane inside JPanel is 600 x 600 pix


How would you draw a sprite ontop of the large image. Lets say the sprite moves to 500,20 [ x,y ] inside the 600sq Panel. How would I redraw a separate part of the image.


Keylistener as I press 'w' i want to relocate the sprite [ y = y +2] and paint a separate image giving the illusion that the sprite is preforming an animation.


Also I would like an If statement declaring the locations of a treasure chests based on the portion of the image that is being displayed.


if(lrgImage_prt = 2) paint chest at x = 20, y = 50; if(lrgImage_prt = 1) paint chest at x = 40, y = 300;


Also I would like to calibrate Image Collision. When sprite is near chest in lrgImage_prt = 2 I would like the option of an action to be preform. Open another window holding ImageIcon with mouse listener with right click to open a JPopupMenu with options to Take Item or Cancel.


if(sprite[x,y] == chest[x,y] && 'c' key is pressed)open new window containing interactive ImageIcons displaying the items inside the chest. How would I manage Items in specific chest like creating a .cfg file or xml configuring the possible items inside individual chest.


I would like to display a smaller image representing the large image inside a sidePanel near the JPanel making the size of the JFrame to be 600 x 800. Display a rectangle inside the smaller image declaring the portion of the large image that is painted inside the JPanel.


Also can I layer another image ontop of the large image declaring the boundries of the path finding. So it wont let the sprite seem like it is moving through walls. Collision Detection.


KeyListen if 'g' is pressed animate slash and apply damage based on the ratio of item_weapon stats item_weapon = iron_sword; iron_sword_stats[] = {23, 45, 3}; // [0]atk, [1]atk_bonus, [2]lv_reqiured


I am an amatur programmer wanting to create a 2d rpg. Later I would like to create a 3d rpg..


No comments:

Post a Comment