Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Pressure bar
- mnh78614
-
17 posts
Pressure bar
Hey guys, so I'm trying to make an archery game. So I'm trying to make a pressure bar, and it's one of those ones where it goes back and fourth until you release the left click thingy. I'm really confused on how to make it, so if anyone could help me that would be very appreciated!
- JsnPrkr
-
100+ posts
Pressure bar
Cool idea, mnh.
Well, the first step is to design (without programming anything yet) how the pressure bar could behave. Here are a couple of ways that come to mind:
1. Click to pull the “string” back, click to release.
2. Click and hold to pull the string back. Release to, um…, release.
3. …?
Can you think of some more ways, even if they don't seem to make much sense or look a bit challenging at first?
Once you have a few to choose from, which one looks like you can program it and is still as realistic as possible? For example, the first behavior above is easier to program. The second one is closer to the way you actually shoot a bow.
Well, the first step is to design (without programming anything yet) how the pressure bar could behave. Here are a couple of ways that come to mind:
1. Click to pull the “string” back, click to release.
2. Click and hold to pull the string back. Release to, um…, release.
3. …?
Can you think of some more ways, even if they don't seem to make much sense or look a bit challenging at first?
Once you have a few to choose from, which one looks like you can program it and is still as realistic as possible? For example, the first behavior above is easier to program. The second one is closer to the way you actually shoot a bow.
- JsnPrkr
-
100+ posts
Pressure bar
…where the pressure either goes back and forth and back and forth by itself and you click to try and pick the pressure.
OR
…you move the mouse to set the pressure instead of having it bounce back and forth by itself.
OR
…you move the mouse to set the pressure instead of having it bounce back and forth by itself.
- mnh78614
-
17 posts
Pressure bar
http://scratch.mit.edu/projects/684287/ something kinda like this, but I can't seem to understand which sprite is which
this is why I name all my sprites lol

- JsnPrkr
-
100+ posts
Pressure bar
That's a neat project. I like it. Not being able to aim after pressing the button is a bit frustrating, though.
Alright. Since this is programming, it helps a bunch to be more specific about the effect you're going for. Would you like the power to be exactly like that, or similar but different in some way? (Talking about just the behavior, not how it looks on the screen.)
If different, then in what way?
(Many people call that left “thingy” a button. Same with the one on the right.) :-P
Alright. Since this is programming, it helps a bunch to be more specific about the effect you're going for. Would you like the power to be exactly like that, or similar but different in some way? (Talking about just the behavior, not how it looks on the screen.)
If different, then in what way?
(Many people call that left “thingy” a button. Same with the one on the right.) :-P
Last edited by JsnPrkr (Jan. 8, 2014 03:51:31)
- mnh78614
-
17 posts
Pressure bar
Similar, I just kinda need the x position of the part to move, and shrink at the same time, kinda like this game https://sites.google.com/site/edugamesunlimited/games/apple-shooter (sorry with piling you up with the game urls lol) except when the pressure is at its max, i want it to go back to 0 or the start, and then go back up, and when you release the arrow from the bow, that it releases it at the amount of pressure that's shown in the bar. I know it's complicated and probably involves a lot of math 

- JsnPrkr
-
100+ posts
Pressure bar
No problem with the urls. In fact, they're good because it helps me understand what you're thinking of and looking for before I start shooting details about code and scripts your way. Include more whenever you think it would help.
On that AppleShooter one, the power goes one way and stops at maximum. After a slight delay, the arrow releases. The first example you gave matched your description:
So, you'd like it to behave exactly the same as the first example? That actually doesn't have to use any math at all.
P.S. Easy with the “kinda”. It makes it hard for me to clearly understand what you're looking for. Computers don't handle “kinda” very well, either. It either is or it ain't. (Don't tell your Mom I'm encouraging you to say “ain't” !) Thanks for being very clear in the last part.
On that AppleShooter one, the power goes one way and stops at maximum. After a slight delay, the arrow releases. The first example you gave matched your description:
when the pressure is at its max, i want it to go back to 0 or the start, and then go back up, and when you release the arrow from the bow, that it releases it at the amount of pressure that's shown in the bar.
So, you'd like it to behave exactly the same as the first example? That actually doesn't have to use any math at all.
P.S. Easy with the “kinda”. It makes it hard for me to clearly understand what you're looking for. Computers don't handle “kinda” very well, either. It either is or it ain't. (Don't tell your Mom I'm encouraging you to say “ain't” !) Thanks for being very clear in the last part.
Last edited by JsnPrkr (Jan. 8, 2014 04:08:43)
- mnh78614
-
17 posts
Pressure bar
yeah exactly, just like the first part, the second url was just to make it more clearer (graphics wise) I'm trying to make a SCRATCH/BYOB version of AppleShooter for my CompSci class
- JsnPrkr
-
100+ posts
Pressure bar
Alright. Sounds like you're in college? What's your major and programming experience?
One thing I had to realize eventually is that you can simulate the physics in a game and be pretty simple about it. It doesn't have to be a precise and mathematically accurate simulation, just a believable one.
Please confirm that you'd like to just duplicate apple shooter (or not). If so, I'll stop dreaming of the dragons (they're very cute).
So here's the spec we've worked out:
1. Click and hold mouse to pull the bowstring.
2. Power bar moves from 0 to max and back to 0, back and forth, until the mouse button is released.
3. Move the mouse to aim. Aiming can be done while mouse button is pressed.
If you're taking CompSci, you must have some initial ideas about how to code this. What are they?
And do you need help with the algorithm or just what commands are available in Scratch to do things like set and change variable values, control program execution with loops and subroutines, etc?
One thing I had to realize eventually is that you can simulate the physics in a game and be pretty simple about it. It doesn't have to be a precise and mathematically accurate simulation, just a believable one.
Please confirm that you'd like to just duplicate apple shooter (or not). If so, I'll stop dreaming of the dragons (they're very cute).
So here's the spec we've worked out:
1. Click and hold mouse to pull the bowstring.
2. Power bar moves from 0 to max and back to 0, back and forth, until the mouse button is released.
3. Move the mouse to aim. Aiming can be done while mouse button is pressed.
If you're taking CompSci, you must have some initial ideas about how to code this. What are they?
And do you need help with the algorithm or just what commands are available in Scratch to do things like set and change variable values, control program execution with loops and subroutines, etc?
Last edited by JsnPrkr (Jan. 8, 2014 04:39:11)
- JsnPrkr
-
100+ posts
Pressure bar
Forum server says “down for maintenance”, mnh. Gotta get to bed, anyway. Work starts at 7:00am.
Someone will probably see this and provide some help before I get back on.
I have some ethical concerns: A look at your posting history shows that this is the third time you've asked for help with a CompSci project in the last four months. There's a limit to how much help someone can give for school assignments and projects without hurting your progress as a student. The question you're asking is pretty basic, too, for someone in a CompSci class that started back in October. I'm willing to help you, but it looks like you're ONLY asking for help on school assignments and possibly relying too much on the Scratch community's willingness to help. It would be best to contribute to the community if you'd like the Scratch community to contribute to your education and your projects. At this point, it looks like you've taken a lot of help and given nothing.
You're also taking a lot of time between replies, which makes it take longer to arrive at the solution you'd like. Faster responses would make it much easier for people to help you, considering your request for help on schoolwork.
Again, I'm willing to help you, mnh, but things seem out of balance here. I'd like to see you put in more effort, respond quicker, and present your ideas about how to achieve what you're trying to do. (And be a member of the community more.)
Someone will probably see this and provide some help before I get back on.
I have some ethical concerns: A look at your posting history shows that this is the third time you've asked for help with a CompSci project in the last four months. There's a limit to how much help someone can give for school assignments and projects without hurting your progress as a student. The question you're asking is pretty basic, too, for someone in a CompSci class that started back in October. I'm willing to help you, but it looks like you're ONLY asking for help on school assignments and possibly relying too much on the Scratch community's willingness to help. It would be best to contribute to the community if you'd like the Scratch community to contribute to your education and your projects. At this point, it looks like you've taken a lot of help and given nothing.
You're also taking a lot of time between replies, which makes it take longer to arrive at the solution you'd like. Faster responses would make it much easier for people to help you, considering your request for help on schoolwork.
Again, I'm willing to help you, mnh, but things seem out of balance here. I'd like to see you put in more effort, respond quicker, and present your ideas about how to achieve what you're trying to do. (And be a member of the community more.)
- mnh78614
-
17 posts
Pressure bar
I'm actually in High School, I have until next friday to complete this, plus tomorrow we have only three periods (every wed. we do due to teacher meetings) so our class period is extend to 85 mins, so I'll have a lot of time tomorrow, but the more i get done the better.
- mnh78614
-
17 posts
Pressure bar
Scratch is just kind of a big jump for me, I was programming in Ruby over the summer, and I did some JavaScript too, so it's a big jump from typing syntax to more digital block syntax. Oh and I'm trying to remake appleshooter. Those were really hard projects that only two or three kids in class had actually gotten a 100% on. The Mario project I got figured out pretty easily after my teacher helped me with the last part, and the min and max functions I had realized my error afterwards.
- JsnPrkr
-
100+ posts
Pressure bar
If you're taking CompSci, you must have some initial ideas about how to code this. What are they?
And do you need help with the algorithm or just what commands are available in Scratch to do things like set and change variable values, control program execution with loops and subroutines, etc?
Got it. Please ASAP answer the two questions in the quote box above and I will check back tomorrow when I can. Might be first thing in the morning, might be on my lunch hour, but could be after work. Thanks for asking for help early enough to have some meaningful discussions. Let's tighten up the response times. Since I can't just give you the answer, this could take a while even if we get back to each other right away.
- JsnPrkr
-
100+ posts
Pressure bar
And post the URL to your Scratch project. I think I can access it if I have the raw URL, assuming that sharing just makes projects show up in searches and on someone's profile page.
-Jason
-Jason
- Paddle2See
-
1000+ posts
Pressure bar
http://scratch.mit.edu/projects/684287/ something kinda like this, but I can't seem to understand which sprite is whichthis is why I name all my sprites lol
An interesting example! I'll see if I can explain it for you. All the power calculation stuff is being done on the bow sprite (sprite2) with the variables called “power” and “power shift”.
The power bar is being continually drawn by sprite7 - it's always clearing and redrawing a line between two hidden sprites called sprite5 and sprite6.
Sprite5 is fixed in place and doesn't move.
Sprite6 is continually being moved left of sprite5 by a distance equal to the “power” variable amount.
The rest of the pressure bar consists of the two vertical line sprites sprite8 and sprite9 that are just positioned to show the full range of the pen sprite, sprite7. Good luck with your game and I agree - naming sprites is the way to go.
A side note about getting help with school projects here in the forums: Different schools have different help policies - some have very strict rules which allow for no assistance at all. We have no way of knowing what your school policies are - it's your responsibility to know them and to follow them.
If we are allowed to help, we need to recognize that it's really important that you learn the concepts and not just complete the assignment. So we should try and limit our assistance to explaining things rather than giving you completed code. We should also encourage you to try things on your own too - tinkering is a great learning technique

- mnh78614
-
17 posts
Pressure bar
I think I'm good now, I got it figured out in class, I'm using BYOB which is a modified version of scratch. In this one, you can't make sprites shrink horizontally, only vertically and horizontally
so I had to make a new sprite which was a vertical bar.

- Discussion Forums
- » Help with Scripts
-
» Pressure bar