This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-22 16:36:15

Kenzypirate
New Scratcher
Registered: 2013-01-21
Posts: 6

New to Scratch, Need help, Adventure Time!

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

 

#2 2013-01-22 17:00:13

bonechill
Scratcher
Registered: 2012-05-02
Posts: 500+

Re: New to Scratch, Need help, Adventure Time!

I'm working on it


http://www.planetminecraft.com/files/sigs/scratch9p_693826_sig.jpg

Offline

 

#3 2013-01-22 17:09:53

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: New to Scratch, Need help, Adventure Time!

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

 

#4 2013-01-22 17:11:49

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: New to Scratch, Need help, Adventure Time!

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)

Now, the problem that's occuring is that whenever the penguin touches the paddle, it turns and might get its flipper stuck in the paddle. Therefor, when it moves, it's still touching the paddle, and giving you more points. So instead, I recommend using this:

when gf clicked
set [score v] to (0)
forever if (touching [ball v]?)
 change [score v] by (1)
 wait until <not (touching [ball v]?)>

Edit: I just found another one of the glitches you were talking about; where the penguin touches the fire, but Fill doesn't appear saying "Haha! You lose!" What's happening here is more or less because of how Scratch was built; it interprets one line of code at a time till it's interpreted each script, then repeats until your program ends. So what's happening in these few occasions is that's Scratch is first sensing that the penguin has touched the fire, so it goes to the position at the top, but then, it interprets the waiting script, sees that it's not touching a fire, and moves on. So instead, of this:

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]

Try compacting them into one single script:

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

Now, you had said that there were a few other glitches; could you point them out to me quickly?

Anyway, I hope that this helps! Remember, if you have any other questions, feel free to ask.

Also, hello Kenzypirate and welcome to Scratch! I hope that you'll do great in your programming class!

Last edited by ErnieParke (2013-01-22 17:39:57)


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2013-01-22 20:12:52

Kenzypirate
New Scratcher
Registered: 2013-01-21
Posts: 6

Re: New to Scratch, Need help, Adventure Time!

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

 

#6 2013-01-24 17:38:15

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: New to Scratch, Need help, Adventure Time!

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  wink  ):

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
hide
Problem 2:

Create a variable called something like DoesScoreCount. As you may surmise from the name this will be used to check whether the game should count the score when it hits the sword.

Set this variable to 1 when the ball touches an edge.
Set the variable to 0 when it touches the sword.

Make your score code look something like this:


if <<touching [ball v]?> and <(DoesScoreCount) = [0]>>
change [score v] by [1]
end

Problem 3:

This is the hardest of all the problems and to fix it you will need to change your code so that the ball is checking if it is touching the paddle in its script rather than the other way around.

Last edited by Smozzick (2013-01-24 17:43:10)


http://i50.tinypic.com/ded8m.png

Offline

 

Board footer