examples/dragNDrop/DragNDrop

From FANG

Jump to: navigation, search

01 package examples.dragNDrop;
02 
03 import fang.*;
04 
05 /**
06  * Example for Draggable sprite.
07  * Updated for FANG Engine release by Jam Jenkins.
08  @author Neal Ehardt
09  */
10 public class DragNDrop extends Game
11 {
12 
13    /** draggable sprite */
14    private Draggable drag;
15 
16    /** Set up draggable. */
17    public void setup()
18    {
19       //link to the help file
20       setHelp("resources/DragNDropHelp.txt");
21       //generate new Draggable, shaped like a circle
22       drag = new Draggablenew OvalSprite(0.20.2) );
23       //put in center of screen
24       drag.setLocation(.5.5);
25       //make the shape take up half the screen
26       //drag.setScale(.2);
27       //add the sprite to the canvas so it can be displayed
28       addSprite(drag);
29       //tell the sprite which mouse to use
30       drag.setMousegetPlayer().getMouse() );
31    }
32 
33    /**
34     @param args not used
35     */
36    public static void main(String[] args)
37    {
38       DragNDrop dragNDrop = new DragNDrop();
39       //only one player needed (not networked)
40       dragNDrop.players = 1;
41 
42       dragNDrop.runAsApplication();
43    }
44 
45 }


Download/View examples/dragNDrop/DragNDrop.java




Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter

Games
Games