input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public void init game panel game frame try cause the resource manager to initialise we do it here since in some cases its important that the game frame has had a chance to initialise before we attempt to load any resources resource init game frame catch exception e if somethign should go wrong print a message and stop the game system out println failed to load resources e get message system exit 0 | will be called once initialistion of the rendering context jogl java2 d |
private boolean move to int x int y check if the destination square is blocked if not then move to it if it is blocked choose a new direction for the badguy if map supports rocks x y map get player get x x map get player get y y choose random direction return false else this x x this y y return true | attempt to move the bad guy to the specified location |
public void draw int xoffset int yoffset resource badguy sprite draw xoffset x 25 yoffset y 25 0 | draw this bad guy at the specified location |
public void set control int direction at the moment we just move when the player pressed the key however at one point the code supported only moving on the poll current direction direction poll current direction none | notification that the user is attempting to move this |
public void init game panel game panel try loader new default sound loader midi1 loader load midi sound resources dash music boulder1 mid midi2 loader load midi sound resources dash music boulder2 mid effect1 loader load digital sound resources dash sounds bop wav effect2 loader load digital sound resources dash sounds drip wav creating font font factory get bitmap font game panel resources dash font png 16 16 catch exception ex something went wrong we should create a better help than this ex print stack trace system exit 0 | this is called from the frame created in the constructor |
public void notify player death update the status message message oh dear you re dead press enter to start again stop the map running running false reset the game values level 0 score 0 | called to indicate that the player has been killed |
public void release control int direction | notification that the user is no longer trying to move |
public void poll depending on the direction we want to move attempt to change the location of this player switch current direction case up move to x y 1 break case down move to x y 1 break case left move to x 1 y break case right move to x 1 y break | poll this player allow it to move or do anything |
public void init game panel game panel try creating geom drawer drawer factory get geom drawer game panel creating font font factory get bitmap font game panel resources dash font png 16 16 creating an animated sprite animspr new animated sprite animspr add image factory game panel resources dash badguy gif 250 animspr add image factory game panel resources dash player gif 250 catch exception ex something went wrong we should create a better help than this ex print stack trace system exit 0 | this is called from the frame created in the constructor |
public void paint graphics g super paint g cycle through all the elements of the map and draw an image for each for int x 0 x 20 x for int y 0 y 20 y g draw image tiles current map get tile at x y x 25 y 25 this | draw the current map onto the panel |
public void notify player death simply tell the game about it game notify player death | notify this map that the player has died |
public void draw game panel game panel draw a filled rectangle drawer fill rect 0 0 150 150 j2 dacolor pure blue false draw a animated sprite animspr draw 100 100 0 draw the font font draw 10 100 all your base are belong to us draw the fps font draw 10 70 game panel get fps | this is called by the game frame to draw the frame |
public void set key count int key count this key count key count | set the number of keys the player has to collect |
public void notify score increase score 100 | called to indicate that the score should be increased |
public void notify score increase simply tell the game about it game notify score increase | notify this map that the score needs increasing |
public void reset answer size 1 | resets the answer to the beginning |
public void init game panel game panel try geom drawer factory get geom drawer game panel eightball factory get sprite game panel resources magiceightball magiceightball png answer1 factory get sprite game panel resources magiceightball answer1 png font factory get bitmap font game panel resources dash font png 16 16 catch exception ex ex print stack trace | inits the renderer loads all needed resources |
public void draw int xoffset int yoffset resource player sprite draw xoffset x 25 yoffset y 25 0 | draw this player at the specified location |
public void draw game panel game panel fill background geom drawer fill rect 10 10 game panel get width 20 game panel get height 20 j2 dacolor gray true draw the answer rotation and size adjusted answer1 draw 100 90 rotation 50 50 increases rotation if game panel get fps 0 rotation 90f float game panel get fps draws the eightball on top of the answer eightball draw 0 0 draws the fps geom drawer fill rect 0 0 100 20 j2 dacolor black true font draw 0 20 fps game panel get fps | draws the eightball |
public void notify level complete simply tell the game about it game notify level complete | notify this map that the level has been completed |
public void notify level complete update the status message message wahay you completed the level press enter for the next one stop the map moving running false move to the next level level | called to indicate that the level has been completed |
private void poll cycle through all the badguys giving them a change to move or whatever for int i 0 i badguys size i bad guy badguys get i poll | poll all the bad guys |
public int get tile at int x int y if the location is valid just return a default value if x 0 x 19 y 0 y 19 return resource stopper otherwise return the type of tile at the specified location return map x y | get the type of tile at the specified location |
public void set tile at int x int y int tile map x y tile | set the tile at a specified location |
public boolean supports rocks int x int y return get tile at x y 0 player get x x player get y y | check if the tile at a specified location supports rocks e |
public void mouse dragged mouse event e mouse pressed e | notification that the mouse has been dragged over |
public sound load digital sound string ref throws sound resource exception return new default digital sound this ref | load a digital sound i |
public sound load midi sound string ref throws sound resource exception return new default midi sound this ref | load a midi track |
public void run boolean running true while running try thread sleep 100 catch exception e if seq is running current sequence null if changing seq start | run every not and again check the track hasnt finished |
public void key released key event e if the game is running then the player must be controllable cursor controls are just passed to the object representing the player if running if e get key code key event vk left current map get player release control player left if e get key code key event vk right current map get player release control player right if e get key code key event vk up current map get player release control player up if e get key code key event vk down current map get player release control player down | notification that a key has been released |
public component get list cell renderer component jlist list object obj int a boolean b boolean c jlabel label jlabel super get list cell renderer component list obj a b c what ever happens just blank the text and reset the image to the image that has been passed in label set text label set icon new image icon image obj return label | get the component to use for each item in a jlist |
public void play if system current time millis last play min interval return last play system current time millis try audio input stream in audio system get audio input stream default digital sound class get class loader get resource ref data line info info new data line info clip class in get format int in get frame length in get format get frame size clip clip clip audio system get line info clip open in clip start catch exception e throw new sound failure exception unabled to load ref e get message | play the sound |
public void play loader play sequence | play the sound |
public void stop loader stop sequence | stop the sound playing |
public void key typed key event e we don t do anything in here | notification that a key has been typed |
public void save output stream out throws ioexception cycle through all the tiles writing them down to the stream for int x 0 x 20 x for int y 0 y 20 y out write map x y | save the map to the specified stream |
protected void finalize clear al | finalise by stopping audio and clearing al resources |
public void play alsound loader this play sound this | play the sound with current gain and looping state etc |
public void stop alsound loader this stop sound this | stop the sound now |
private int buffer get buffer return buffer | get the buffer containing audio data to play |
public void set gain float gain if gain 0f this gain 0f else if gain 1 0f this gain 1 0f else this gain gain | setter for property gain |
public void set drop stack drop stack drop stack this drop stack drop stack drop stack set width get width | setter for property |
public index randomiser get randomiser return randomiser | getter for property randomiser |
public void set randomiser index randomiser randomiser this randomiser randomiser | setter for property randomiser |
public grid position get position return position | getter for property position |
public void set position1 org puzzlebeans grids grid position position1 this position1 position1 | setter for property position1 |
public void set position2 org puzzlebeans grids grid position position2 this position2 position2 | setter for property position2 |
public void set drop stacks java util array list drop stacks this drop stacks drop stacks | setter for property drop stacks |
public boolean is pool open return pool open | getter for property pool open |
public grid position get offset return offset | getter for property offset |
public void set pool open boolean pool open this pool open pool open | setter for property pool open |
public void set offset grid position offset this offset offset | setter for property offset |
public void bounce bounced true | set bounced to true |
public void receive string s logger info received string s for iterator it receivers iterator it has next string receiver it next incoming string s | pass a string to this relay to be received |
public void add receiver string receiver receiver receivers add receiver | add a receiver to be given all strings received by this relay |
public void remove receiver string receiver receiver receivers remove receiver | remove a receiver |
public void mark as received received true | mark that the message has been received |
public boolean is cosmetic return false | defaults to false |
public long get most recent pull return most recent pull | getter for property most recent pull |
public void set most recent pull long most recent pull this most recent pull most recent pull | setter for property most recent pull |
public bean grid get bean grid return bean grid | getter for property bean grid |
public long get complete time return complete time | getter for property complete time |
public long get delay time return delay time | getter for property delay time |
public void set complete time long complete time this complete time complete time | setter for property complete time |
public long get normal interval return normal interval | getter for property normal interval |
public void set end type int end type this end type end type | setter for property end type |
public void set normal interval long normal interval this normal interval normal interval set fast drop state this will make sure we have correct new interval for current setting set fast drop dropping fast | setter for property normal interval |
public boolean is cosmetic return true | this event is cosmetic returns true |
public void complete can complete true | let this event know it can signal it can complete |
public long get short interval return short interval | getter for property short interval |
public int get chain count return chain count | getter for property chain count |
public int get chain level return chain level | getter for property chain level |
public int get chara number return chara number | getter for property chara number |
public long get most recent score time return most recent score time | getter for property most recent score time |
public void set most recent score time long most recent score time this most recent score time most recent score time | setter for property most recent score time |
public int get score degree return score degree | getter for property score degree |
public void set score degree int score degree this score degree score degree | setter for property score degree |
public double get start rate return start rate | getter for property start rate |
public int get xmove return x move | getter for property x move |
public int get ymove return y move | getter for property y move |
public boolean get move back on complete return move back on complete | getter for property move back on complete |
public void set move back on complete boolean move back on complete this move back on complete move back on complete | setter for property move back on complete |
public void set random source java util random random source this random source random source | setter for property random source |
public void set next org puzzlebeans beans two bean drop next this next next | setter for property next |
public void set next but one org puzzlebeans beans two bean drop next but one this next but one next but one | setter for property next but one |
public void set grid org puzzlebeans grids bean grid grid this grid grid | setter for property grid |
public long get drop increment interval return drop increment interval | getter for property drop increment interval |
public int get colour count return colour count | getter for property colour count |
public int get group points return group points | getter for property group points |
public void set colour count int colour count this colour count colour count | setter for property colour count |
public void set drop increment interval long drop increment interval this drop increment interval drop increment interval | setter for property drop increment interval |
public void set previous org puzzlebeans beans two bean drop previous this previous previous | setter for property previous |
public long get anim time return anim time | getter for property anim time |
public void set group points int group points this group points group points | setter for property group points |
public void set anim time long anim time this anim time anim time | setter for property anim time |
public long get last drop increment time return last drop increment time | getter for property last drop increment time |
public void set last drop increment time long last drop increment time this last drop increment time last drop increment time | setter for property last drop increment time |
public int get hit on adjacent pop return hit on adjacent pop | getter for property hit on adjacent pop |
public void set hit on adjacent pop int hit on adjacent pop this hit on adjacent pop hit on adjacent pop | setter for property hit on adjacent pop |
public int get hit on group return hit on group | getter for property hit on group |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.