So, I'm extremely new to Scratch. I go to the Art Institute of Indianapolis and my major is Web Design. So in one of my classes, Program Logic, we've began to use Scratch. I posted my first game I've ever made on here, it's a very simple Adventure Time Pong game. Basically, you bounce the penguin around for as long as you can. But there are some glitches, or something wrong, that I haven't quite figured out yet. The score sometimes messes up and a couple other small things that you'll notice by playing it. We have to have this game finished for a project in class and I was wondering if by any chance someone could check out the game and give me some pointers. It'd be greatly appreciated! Thankyou!
Offline
The problem you're seeing involves the collision-checking logic. More or less, what you have right now looks like this:
Forever:
If I'm touching the paddle,
Bounce, by turning some number of degrees.
Increment score.
However, the program doesn't account for the fact that turning could reintroduce the touching condition. The solution is fairly simple to implement; you don't register bounces again until after the two sprites are no longer touching.
Forever:
If I'm touching the paddle,
Bounce, by turning some number of degrees.
Increment score.
Wait until I'm not touching the paddle anymore.
This will also ensure that the score increase by only one for each bounce.
Hope that helps!
Last edited by amcerbu (2013-01-22 17:15:36)
Offline
Kenzypirate wrote:
So, I'm extremely new to Scratch. I go to the Art Institute of Indianapolis and my major is Web Design. So in one of my classes, Program Logic, we've began to use Scratch. I posted my first game I've ever made on here, it's a very simple Adventure Time Pong game. Basically, you bounce the penguin around for as long as you can. But there are some glitches, or something wrong, that I haven't quite figured out yet. The score sometimes messes up and a couple other small things that you'll notice by playing it. We have to have this game finished for a project in class and I was wondering if by any chance someone could check out the game and give me some pointers. It'd be greatly appreciated! Thankyou!
As for the score glitch, you have this script:
when gf clicked set [score v] to (0) forever if (touching [ball v]?) change [score v] by (1)
when gf clicked set [score v] to (0) forever if (touching [ball v]?) change [score v] by (1) wait until <not (touching [ball v]?)>
when gf clicked show variable [score v] hide variable [speed v] forever if (touching [Dead Area v]?) go to x: (0) y: (120) end
when gf clicked wait until (touching [Dead Area v]?) broadcast [Lose v]
when gf clicked show variable [score v] hide variable [speed v] forever if (touching [Dead Area v]?) go to x: (0) y: (120) broadcast [Lose v] end
Last edited by ErnieParke (2013-01-22 17:39:57)
Offline
Thank you guys so much for this! This actually helped a ton, and if I find anything else that I can't figure out, I will definitely come here. Thanks to you guys I actually feel confident about turning in my project now. Again, thanks a ton!
Offline
This is a copy paste from your other thread and so may cover some issues that have already been covered.
----
Downloading to have a look at it now. Very nice graphics.
EDIT: Just to mention, this would be more likely to get a response in the help with scripts section.
----
Hope some of this helps!
Things to Look at so Far:
Problem 1 (Optional): Sword, score and ball show on front page; it's kind of odd. More importantly sword still allows movement which looks a bit weird.
Problem 2: If you move the sword quickly through the penguin ball you'll get multiple points because of the forever if touching ball score + 1 script. You should probably add a variable to make sure its its first touch recently.
Problem 3: Occasionally score won't increment when ball is hit. This is probably due to having the score increment and ball movement in seperate scripts. The movement script is likely running before the score increment in this case and the ball is already not touching the sword by the time it checks.
---
Things to Keep in Mind (maybe don't keep in mind till I've updated and made sure it makes sense ):
It's generally best to keep scripts that rely on each other in the same script instead of separate ones because this is a procedural language so one is coming after the other and separately you don't know which.
---
Possible Solutions to Problems
Some possible solutions to the problems; there are no doubt other ways that will also work.
Please try these out on a copy of your project and not on the original!
Problem 1: This would be solved by using a broadcast to start the game. You would put somewhere, maybe on the stage, something like:
When gf clicked wait until <key [space v] pressed broadcast [StartGame v]And put into all of the scripts where you currently have
When gf clicked
When I receive [StartGame v]and then add new scripts saying
When gf clicked hideProblem 2:
if <<touching [ball v]?> and <(DoesScoreCount) = [0]>> change [score v] by [1] endProblem 3:
Last edited by Smozzick (2013-01-24 17:43:10)
Offline