pong, baseball-style

Ever had one of those days when your IDE decides to rebel? Today was that day for me in Snap and what it did was lost several of the blocks in the Variables category that I needed to do my Pong.  Namely, I lost the ability to set variables and the ability to change them.  These were the blocks I lost.This meant I couldn’t track the score or change the speed of the ball (the particular things I was attempting to do when I noticed the blocks had gone missing from the palette).  This was highly annoying.

About all I could do was open another Snap in another browser window and rebuild my code.  Because exporting to XML and importing back into Snap brought the anemic palette with me.

It took a long time, as I was mostly finished, too.  I was struggling with reflections and had finally figured them out (including how to apply  what I think is called “English”).  And I was to the part of putting in sounds.  I got all my sounds from freesound.org which is searchable.

Of course my Pong is baseball-themed—what else would you expect? I use sprites for all the edges because I know how to easily test for that and play a sound when sprites touch (and I heard there was a glitch with other kinds of detection and rather than explore them, I figured I’d be lazy).  I don’t know if my sprites need to be as big as I make them, but I’ve noticed that size does not equate to pixels, but to “steps” and (again) I’m too lazy to figure it out.

On the off-chance someone messes with my field, when the green flag is clicked, I put things in their places.  I uncheck the box at the top of each sprite for draggability but that might not stop someone who is determined.  Here’s a screenshot of the pregame.
You can see it here.  Don’t know that I’m off hiatus, but I may be.

Hiatus

This blog is on hiatus due to Harvey.  I’m plugging away at Pong (working on how to get my ball to reflect), but sporadically due to things like lines at the grocery store to get essentials that I thought we had a sufficiency of (but was, apparently, mistaken).

I am safe and dry, but have friends in need of help.  Also I plan to donate blood this week if the center is open.  I’ll be back with Pong as soon as I am able.

Prayers and good thoughts are welcome, but donations are even moreso. Please, use Charity Navigator if you are unsure of where to give as they will help you find the places where your donations go the furthest.

repeat after me (kaleidoscope)

No, Pong is not the next Snap project—a kaleidoscope is.  Here is the example of the kind of thing they mean by a kaleidoscope.

Four sprites moving in synchrony.  This example was presented as you see it—in .gif format.  No clues on how to make one like it except some platitudes. “You will need four sprites.” Well no shaving cream, Sherlock! “The easiest way to create three more is to duplicate the one you have.” You mean there are other ways?  The only way I could figure out to make more sprites without cracking the manual (there is one) is by right-clicking the existing sprite and clicking duplicate.  That also duplicates the code.  So I did break down and look at the manual.

It turns out that green flag is at the top of the stage.  Quick peeky-see at the names of all the areas on the Snap screen—from the actual homework that I actually did that had the actual kaleidoscope program assigned. Here’s that picture.

See the flag?  When you click that, it counts for all the sprites that have that block of code so you can start …. say, four sprites, and have them do synchronous stuff. This is what I came up with.  It is similar, but different, you can look at the code by exiting full-screen mode.  I think that it’s more of the sort of thing I think of as kaleidoscopic.  I think the color should be the same for all sprites but change over time.

Now, I’m ready for Pong.  Well, no, that’s not right, now the next major project i turn in is Pong.  I’ll probably do some other things in the meanwhile.  Pong has a rubric. For those who don’t know, a rubric is a scoring chart that lists aspects of my program and how many points each is worth.  Everything from “Players can control paddles with required keys” to “Program is well-documented and exhibits good style.” Whoa, documented? I don’t think I saw comment blocks in Snap (not that I was looking, mind you).  I’m usually adequate at commenting. I hope that’s good enough for my grader. I guess I’ll find out.

Wish me luck!