Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make air hockey game using processing python . Project 2: Air Hockey Game We'll be creating a 1 player air hockey game using the concepts

make air hockey game using processing python image text in transcribed
image text in transcribed
image text in transcribed
. Project 2: Air Hockey Game We'll be creating a 1 player air hockey game using the concepts we learned about earlier tod Picture: Image of Initial State Video: Example Gameplay. Most of what you need you've already done todaypuck (circle), bouncing movements, and p components in a customized manner to create an interactive game. Functionality The game play will be slightly different than the typical Air Hockey game. In this version, we'll play will consist of a single paddle and a puck. The puck can drop off the playable area if it mi: goes through the slot at the top. In general, when the puck goes through the slot at top, we car display a score total as a bonus challenge). Unlike typical Air Hockey that you've seen before, the paddle can only move horizontally along Requirements 1. Slot - Slot at the top of the screen should allow the puck to pass through and not bounce. the drawing 2. Bottom edge - The bottom edge of the playing field should allow the puck to pass through falling off 3. Mouse click events - When the puck is resting on the paddle (not puckinPlay), the mouse c 4. Puck on paddle - When the puck is resting on the paddle, it should sit on the center of it as 5. You're free to construct the randomized puck velocity as you wish so long as the game is Suggested Dimensions To make the proportions similar to what's in the demo, here are the suggested dimensions of the Paddle is 100 pixels wide by 20 pixels tall (height). Puck has a radius of 25 pixels, which means it's 50 wide and 50 tall (height) when using ell Slot at the top is aligned to center of the top of the screen at (200,0). It extends from (125,0 Generally, anything from [0, 125] and [275, 400] in the X coordinate up top should result Starter code Type here to search a ode A Copy to Drive size(400, 600) background (255) global speed, Speedy, X, Y, puckRadius, puckinPlay speedx = 0 Speedy = 0 puckInPlay = False x 100 Y = 100 puckRadius = 25 Draws the one sided playing table with slot/goal on the top. No need to modify this unless you want to tinker with the look. def drawTable(): fille, 220, 255) circle(20, 0, 150) fill(255, 0, 0) circle(280, 380, 100) fill(255, 255, 255) circle(200, 30e, 90) fill(255, 0, 0) circle(200, 300, 10) rect(0, 300, 150, 2) rect(250, 300, 150, 2) * Majority of the logic goes in this function. def draw(): global speed, speedy, X, Y, puckRadius, puckInPlay background (255) Draw background of the playing field. (Don't modify unless you aren't using a 400x600 playing field. deaTable) INSERT CODE] Move puck (hint: use speedx 7 speedy) Initial starting state where the puck follows the mouse above the paddle. Understand how this works so we can utilize this logic in mouse Pressed() below If not puckt Play: Xrouse cladius # Draw puck & paddle. Here's the puck & paddle to get you started. fill(255, 0, 0) ellipse(X, Y, puckRadius * 2, puckRadius * 2) # Puck fill(237, 131, 50) rect(mousex 50, 580, 100, 20) # Paddle # [INSERT CODE] Bounce puck off left and right side of screen # [INSERT CODE] Detect if puck is off the bottom of the screen # [INSERT CODE] Detect if puck crosses through the slot up top def mousePressed(): global speedx, speedy, puckinPlay print("Pressed") # Just a print debug statement. # Logic to launch puck if we have the puck resting on the paddle. # If we're not in play, we should set speed and speedy variables as # well as enable puckInPlay. if not puckinPlay: # Add code here for getting the puck going. Remove the pass statement as # that's just here so the code can run without any statements. pass

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago