ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 05 May 2017 My Price 8.00

a small display of fireworks

Could someone please help me with my code? I want d2 (beat.aiff sound file) to play when a player wins but it won't play for me. I also want the game to return to a new game by pressing the space bar when it's game over and I want to add a small display of fireworks in the background when a player wins. Could someone help me with this? (See code below) int w = 7; int h = 6; int bs = 100; //blockSpace int player = 1; int[][] board = new int[h][w]; void setup() { size(700,600); ellipseMode(CORNER); //draw circles from their top left point } int p(int y, int x) { return (y < 0 || x < 0 || y >= h || x >= w) ? 0 : board[y][x]; } int getWinner() { //loops through rows, columns, diagonals, etc for (int y=0;y= 0;y--) if (board[y][x]==0) return y; return -1; } void mousePressed() { int x = int(mouseX / bs), y = nextSpace(x); if (y >= 0) { board[y][x] = player; //this is not the final solution player = player==1?2:1; //switch to the other player (1->2 2->1) } } void draw() { if (getWinner()==0) { for (int j=0;j0) { fill(board[j][i]==1?255:0, board[j][i]==2?255:0, 0); ellipse(i*bs, j*bs, bs, bs); } } } else { background(0); fill(0,100,180); textSize(30); // Display score information on the screen text("Player "+getWinner()+" wins. ",width/2.85,height/2); if(keyPressed == true) { //keyPressed == ' '; } } }

Answers

(11)
Status NEW Posted 05 May 2017 08:05 AM My Price 8.00

-----------

Attachments

file 1493972203-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)