I have pasted the key position below every time I take my keyboard to the object but it is refreshing the page . How do I create it so that the object does not refresh and it looks like image trails and it eventually draws.
package javagame; Import org.lwjgl.input *; Import org.newdawn.slick. *; Import org.newdawn.slick.state. *; Public class menu BasicGameState provides {public static string mouse = "the mouse is not on the screen"; Public stable string keyboard = "hey"; Public static int keybodedx = 50; Public stable int keyboardbo Y = 50; Public static int xPos; Public fixed int yPos; Public Menu (int state) {} // to this method is to get started right away objects presented public void init (GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {} public void (GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics g) SlickException {g .drawString throws (icons, xps, 500 - yPos); G Dre String (keyboard, keybox, key bodywork); } Public Zero Update (GameContainer gameContainer, StateBasedGame stateBasedGame, Integer Delta) throws SlickException {// Keyboard input input = gameContainer.getInput (); If (input.isKeyDown (Input. KEY_UP)) {keyBoardY - = 1; } And if (input.isKeyDown (Input. KEY_DOWN)) {keyBoardY + = 1; } And if (input.isKeyDown (Input. KEY_LEFT)) {keyBoardX - = 1; } And if (input.isKeyDown (input.KEY_RIGHT)) {keyBoardX + = 1; }} Public int getID () {return 0; A}}
It's like "image trails and finally draws" look For, you actually keep redrawing the image in a pre-condition until you want it to disappear. Otherwise your method is only render the current situation will make again and there will be no "trailing" Shadow may be an option Xy keep history limit the co-directions, and history on every render () calls To make everything again. To create the effect of fading / trailing alpha least you can do this by setting the font to Graphics
rendering, a a font object color prior to use
With a lower alpha value
No comments:
Post a Comment