I have joined a special school that has advanced computer education. We are to make a scene or games with scratch. This is my first time using scratch and I wanted to ask a question. Is it possible to make sort of a toggle/trigger? My idea is that a cannon/gun shoots projectiles at you sprite. When the projectile reaches the edge of your sprite than the background would change and you would have lost a life. Is it possible to make it so that if a projectile hits even the edge of your sprite than your background would change? Please answer quickly. I probably have around 1-2 months but I have no experience so I want a head start. all help would be appreciated.
Offline
First of all, I am quite jealous of your opportunity to join such a school
Secondly, is this what you want:
When a sprite is touched by another (the cannon ball), the background changes and a variable decreases by one
For the main-character sprite use this:
when gf clicked forever wait until <not<touching [cannon-ball v]?>> // stops sprite from double-counting the same shot wait until <touching [cannon-ball v]?> broadcast [change background v] change [health v] by (-1)And for the background/stage:
when I receive [change background v] switch to costume [costume1 v]
Offline
thank you so much for the quick response. I think this will help a ton. Also I'm not that proud of going into the school. The school is pretty great but I had to pass a test to make it. I failed it and I was one of the first on the waiting list. A few weeks later I found out that I was off the waiting list and in the program. There was only one celebration I wanted that day and it came true. NON STOP EATING OF INSTANT NOODLES FOR THE WHOLE DAY!
Offline
I wish my school had programming classes. ;_;
I mean it does have Scratch (6/7 grades) and Web Design but they leave out Java and stuff!
Offline
mythbusteranimator wrote:
I wish my school had programming classes. ;_;
I mean it does have Scratch (6/7 grades) and Web Design but they leave out Java and stuff!
My state has an online school, so I'm taking Java I online and the rest of my classes at a physical high school.
Offline
MoreGamesNow wrote:
mythbusteranimator wrote:
I wish my school had programming classes. ;_;
I mean it does have Scratch (6/7 grades) and Web Design but they leave out Java and stuff!My state has an online school, so I'm taking Java I online and the rest of my classes at a physical high school.
You get to take Java?
Offline
Um I'm sort of stuck on something else. I want to have enough cannonballs to that there is only one space that your sprite can move to to dodge it. E.g pretend that each o is a cannon ball and ^^ is the sprite i want it sort of like this
ooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooo
^^
I want the space where a a cannon ball won't fall to randomize each time please help and sorry for the long message. (P.S how do you have a signature under each post?)
Offline
archlordtroller wrote:
(P.S how do you have a signature under each post?)
Signatures are a scratcher feature; meaning you'll have to become a scratcher before getting one, though if you're active for atleast a month, you should become a scratcher after your wait. And for when you do become a scratcher, just click the Profile button at the top of any forum page, go to Personality, and you'll be able to create your signature.
And just to say, if no one answers your first question by tomorrow, I'll try and answer it.
Anyway, I hope that this answers your second question! And welcome to scratch! I wish you good luck on learning how to code!
Last edited by ErnieParke (2012-12-03 20:00:52)
Offline
Thank you so much. This website is so nice and inclusive. I wish every forum I went to was this active and empathetic.
Offline
mythbusteranimator wrote:
You get to take Java?
Yes, my physical high school really only offers one programming class, but, as I mentioned above, the online high school offers Java I. In my opinion, it is quite similar to C (which I know vaguely) and, to a much lesser extent, JavaScript (which I know fairly well).
archlordtroller wrote:
Um I'm sort of stuck on something else. I want to have enough cannonballs to that there is only one space that your sprite can move to to dodge it. E.g pretend that each o is a cannon ball and ^^ is the sprite i want it sort of like this
ooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooo
^^
I want the space where a a cannon ball won't fall to randomize each time please help and sorry for the long message. (P.S how do you have a signature under each post?)
Ah, this will be much more difficult. There is really no way to script cannon balls without using multiple sprites, and even then the scripts that fire them are more complex than the simple collision script above.
Anywhere:
when gf clicked forever broadcast [fire v] and wait wait (3) secs // interval between firingsFor first cannon ball:
when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim show repeat until<touching [edge v]?> move (4) steps end hideFor the second cannon ball:
when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.5) secs // increase the time for each cannon ball so the fire in sequence show repeat until<touching [edge v]?> move (4) steps end hideBetween two cannon balls, simply leave a large gap of time (I'm making a guesstimate of 1-2 seconds, but it depends on the speed of your main sprite, the speed of the cannon balls (4 in the above example) etc.)
Last edited by MoreGamesNow (2012-12-03 21:40:00)
Offline
im sorry but there is one more thing. I wanted my main character to move by following the mouse. I did that so far and I made the cannon ball follow the main character. However i have to go into each separate script to start there actions. I can't press the green start flg on the top right corner. i have to go to each sprite's script and press the green flach in the script
Offline
archlordtroller wrote:
im sorry but there is one more thing. I wanted my main character to move by following the mouse. I did that so far and I made the cannon ball follow the main character. However i have to go into each separate script to start there actions. I can't press the green start flg on the top right corner. i have to go to each sprite's script and press the green flach in the script
Could you post your scripts or upload your project so that I can help hunt down what's going wrong?
MoreGamesNow wrote:
mythbusteranimator wrote:
You get to take Java?
Yes, my physical high school really only offers one programming class, but, as I mentioned above, the online high school offers Java I. In my opinion, it is quite similar to C (which I know vaguely) and, to a much lesser extent, JavaScript (which I know fairly well).
archlordtroller wrote:
Um I'm sort of stuck on something else. I want to have enough cannonballs to that there is only one space that your sprite can move to to dodge it. E.g pretend that each o is a cannon ball and ^^ is the sprite i want it sort of like this
ooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooo
^^
I want the space where a a cannon ball won't fall to randomize each time please help and sorry for the long message. (P.S how do you have a signature under each post?)Ah, this will be much more difficult. There is really no way to script cannon balls without using multiple sprites, and even then the scripts that fire them are more complex than the simple collision script above.
Anywhere:when gf clicked forever broadcast [fire v] and wait wait (3) secs // interval between firingsFor first cannon ball:when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim show repeat until<touching [edge v]?> move (4) steps end hideFor the second cannon ball:when I receive [fire v] go to [cannon v] point towards [main-character v] // or wherever they should aim wait (0.5) secs // increase the time for each cannon ball so the fire in sequence show repeat until<touching [edge v]?> move (4) steps end hideBetween two cannon balls, simply leave a large gap of time (I'm making a guesstimate of 1-2 seconds, but it depends on the speed of your main sprite, the speed of the cannon balls (4 in the above example) etc.)
Edit: if ErnieParke of someone else wants to check my script that'd be great
There's nothin that I can see wrong, though your script is going to stagger the cannonballs so that it looks more like this:
O O O O O O O O O
It's probably not exactly what archlordtroller wants, but it'll work.
Last edited by ErnieParke (2012-12-04 20:42:02)
Offline
how can i add a file. it is a bit complex because there are different scripts for each sprite
Offline
How to upload a project you mean? In scratch press the button to the right of the save button (the share this project button) and enter the details.
Is this the type of thing you're doing? Link to project
Like I mentioned the problem would be (as Erniepark wrote) that there would be staggering with the cannonballs. One possible solution to this is to keep all of the cannonballs in one costume and change the costume as necessary.
A version with them all in one costume: Link to project
Last edited by SketchSmozzick (2012-12-05 15:10:40)
Offline
Sorry it is a bit different. I have sprite one following the mouse pointer moving at 6.75 steps while the sprite number 2 is chasing it. I wrote that if they touch the sprite one losses 1 health. But the health doesn't go down by one if they touch
Offline
http://scratch.mit.edu/projects/archlordtroller/2960212 that is my project
Offline