Lateo.net - Flux RSS en pagaille (pour en ajouter : @ moi)

🔒
❌ À propos de FreshRSS
Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierRaspberry Pi

Let’s do virtual sports with Digital Making at Home!

Join us for Digital Making at Home: this week, young people get to make sports games in Scratch! With Digital Making at Home, we invite kids all over the world to code along with us and our new videos every week.

So get ready to exercise your digital making skills with us:

Check out this week’s sporty code-along projects!

And tune in on Wednesday 2pm BST / 9am EDT / 7.30pm IST at rpf.io/home to code along with our live stream session.

The post Let’s do virtual sports with Digital Making at Home! appeared first on Raspberry Pi.

Code Hyper Sports’ shooting minigame | Wireframe #35

Gun down the clay pigeons in our re-creation of a classic minigame from Konami’s Hyper Sports. Take it away, Mark Vanstone

Hyper Sports

Hyper Sports’ Japanese release was tied in with the 1984 Summer Olympics.

Hyper Sports

Konami’s sequel to its 1983 arcade hit, Track & Field, Hyper Sports offered seven games – or events – in which up to four players could participate. Skeet shooting was perhaps the most memorable game in the collection, and required just two buttons: fire left and fire right.

The display showed two target sights, and each moved up and down to come into line with the next clay disc’s trajectory. When the disc was inside the red target square, the player pressed the fire button, and if their timing was correct, the clay disc exploded. Points were awarded for being on target, and every now and then, a parrot flew across the screen, which could be gunned down for a bonus.

Making our game

To make a skeet shooting game with Pygame Zero, we need a few graphical elements. First, a static background of hills and grass, with two clay disc throwers each side of the screen, and a semicircle where our shooter stands – this can be displayed first, every time our draw() function is called.

We can then draw our shooter (created as an Actor) in the centre near the bottom of the screen. The shooter has three images: one central while no keys are pressed, and two for the directions left and right when the player presses the left or right keys. We also need to have two square target sights to the left and right above the shooter, which we can create as Actors.

When the clay targets appear, the player uses the left and right buttons to shoot either the left or right target respectively.

To make the clay targets, we create an array to hold disc Actor objects. In our update() function we can trigger the creation of a new disc based on a random number, and once created, start an animation to move it across the screen in front of the shooter. We can add a shadow to the discs by tracking a path diagonally across the screen so that the shadow appears at the correct Y coordinate regardless of the disc’s height – this is a simple way of giving our game the illusion of depth. While we’re in the update() function, looping around our disc object list, we can calculate the distance of the disc to the nearest target sight frame, and from that, work out which is the closest.

When we’ve calculated which disc is closest to the right-hand sight, we want to move the sight towards the disc so that their paths intersect. All we need to do is take the difference of the Y coordinates, divide by two, and apply that offset to the target sight. We also do the same for the left-hand sight. If the correct key (left or right arrows) is pressed at the moment a disc crosses the path of the sight frame, we register a hit and cycle the disc through a sequence of exploding frames. We can keep a score and display this with an overlay graphic so that the player knows how well they’ve done.

And that’s it! You may want to add multiple players and perhaps a parrot bonus, but we’ll leave that up to you.

Here’s Mark’s code snippet, which creates a simple shooting game in Python. To get it working on your system, you’ll need to install Pygame Zero. And to download the full code and assets, go here.

Get your copy of Wireframe issue 35

You can read more features like this one in Wireframe issue 35, available now at Tesco, WHSmith, and all good independent UK newsagents.

Or you can buy Wireframe directly from Raspberry Pi Press — delivery is available worldwide. And if you’d like a handy digital version of the magazine, you can also download issue 35 for free in PDF format.

Make sure to follow Wireframe on Twitter and Facebook for updates and exclusive offers and giveaways. Subscribe on the Wireframe website to save up to 49% compared to newsstand pricing!

The post Code Hyper Sports’ shooting minigame | Wireframe #35 appeared first on Raspberry Pi.

I feel the earth move under my feet (in Michigan)

Par : Alex Bate

The University of Michigan is home to the largest stadium in the USA (the second-largest in the world!). So what better place to test for spectator-induced seismic activity than The Big House?

The Big House stadium in Michigan

The Michigan Shake

University of Michigan geology professor Ben van der Pluijm decided to make waves by measuring the seismic activity produced during games at the university’s 107601 person-capacity stadium. Because earthquakes are (thankfully) very rare in the Midwest, and therefore very rarely experienced by van der Pluijm’s introductory geology class, he hoped this approach would make the movement of the Earth more accessible to his students.

“The bottom line was, I wanted something to show people that the Earth just shakes from all kinds of interactions,” explained van der Pluijm in his interview with The Michigan Daily. “All kinds of activity makes the Earth shake.”

The Big House stadium in Michigan

To measure the seismic activity, van der Pluijm used a Raspberry Pi, placing it on a flat concrete surface within the stadium.

Van der Pluijm installed a small machine called a Raspberry Pi computer in the stadium. He said his only requirements were that it needed to be able to plug into the internet and set up on a concrete floor. “Then it sits there and does its thing,” he said. “In fact, it probably does its thing right now.”

He then sent freshman student Sahil Tolia to some games to record the moments of spectator movement and celebration, so that these could be compared with the seismic activity that the Pi registers.

We’re not sure whether Professor van der Pluijm plans on releasing his findings to the outside world, or whether he’ll keep them a close secret with his introductory students, but we hope for the former!

Build your own Raspberry Pi seismic activity reader

We’re not sure what other technology van der Pluijm uses in conjunction with the Raspberry Pi, but it’s fairly easy to create your own seismic activity reader using our board. You can purchase the Raspberry Shake, an add-on board for the Pi that has vertical and horizontal geophones, MEMs accelerometers, and omnidirectional differential pressure transducers. Or you can fashion something at home, for example by taking hints from this project by Carlo Cristini, which uses household items to register movement.

The post I feel the earth move under my feet (in Michigan) appeared first on Raspberry Pi.

❌