Auto007 wrote:
ErnieParke wrote:
Auto007 wrote:
How can i make a Sprite go elliptical orbit ?
Well, there are two ways. Do you want the more complicated (math wise), more easily edited version or the simpler, harder to edit version?
Gosh !! You always confuse me . Here and in idea shop also !
Can't you tell me both methods ?
Well one method is this (from when I helped mithbusteranimator):
Note: Your code is halfway down.
ErnieParke wrote:
4). The last of the four methods is here. Basically it utilizes velocity to create the button's movement. It's also easily let's your buttons move in an ellipse as opposed to the circles of the above scripts, unless you add a few modifications, which you can ask me about. So, what you'll need is a variable called x velocity and y velocity. Then, you'll need to use this:
set [x velocity v] to (5) set [y velocity v] to (0) repeat (6) change x by (x velocity) change y by (y velocity) change [x velocity v] by (-1) change [y velocity v] by (1) end
Or, if you want an elipse, you could try something more similar to this:set [x velocity v] to (5) set [y velocity v] to (0) repeat (6) change x by (x velocity) change y by (y velocity) change [x velocity v] by (-1) change [y velocity v] by (2)//Key change. end
Note: Remember, these all aren't going to be exactly 100% of what you wanted, so some tweaking will be needed.
As for the other method, I'll get it to you soon.
Offline
ErnieParke wrote:
Auto007 wrote:
ErnieParke wrote:
Well, there are two ways. Do you want the more complicated (math wise), more easily edited version or the simpler, harder to edit version?Gosh !! You always confuse me . Here and in idea shop also !
Can't you tell me both methods ?Well one method is this (from when I helped mithbusteranimator):
Note: Your code is halfway down.ErnieParke wrote:
4). The last of the four methods is here. Basically it utilizes velocity to create the button's movement. It's also easily let's your buttons move in an ellipse as opposed to the circles of the above scripts, unless you add a few modifications, which you can ask me about. So, what you'll need is a variable called x velocity and y velocity. Then, you'll need to use this:
set [x velocity v] to (5) set [y velocity v] to (0) repeat (6) change x by (x velocity) change y by (y velocity) change [x velocity v] by (-1) change [y velocity v] by (1) end
Or, if you want an elipse, you could try something more similar to this:set [x velocity v] to (5) set [y velocity v] to (0) repeat (6) change x by (x velocity) change y by (y velocity) change [x velocity v] by (-1) change [y velocity v] by (2)//Key change. end
Note: Remember, these all aren't going to be exactly 100% of what you wanted, so some tweaking will be needed.
As for the other method, I'll get it to you soon.
I just realized a really effective, simple, and flexible way for a sprite to go in an elipse. So first, you'll need a variable called "T". Then, use this script:
when gf clicked set [T v] to (0) forever go to ((([sin v] of (T)) * (1)) + [Offset])//1 is length of ellipse left and right. go to ((([cos v] of (T)) * (1)) + [Offset])//1 is length of ellipse up and down. change [T v] by (1)//Speed of sprite.
Offline
Offline
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!
Offline
Pharosz wrote:
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!
Well, I think something might have gone wrong when you were copying the script, seeing as it shouldn't be doing this in normal situations. So could you show your script?
Offline
ErnieParke wrote:
Pharosz wrote:
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!Well, I think something might have gone wrong when you were copying the script, seeing as it shouldn't be doing this in normal situations. So could you show your script?
Can I send a printscreen tou you by mail?
Offline
Pharosz wrote:
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!
Maybe it was an old article from the wiki and doesn't work anymore?
Screenshots are encouraged!
Upload your screenshot to tinypic and post the link here.
Last edited by Blazingwave (2013-02-02 19:10:30)
Offline
Blazingwave wrote:
Pharosz wrote:
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!Maybe it was an old article from the wiki and doesn't work anymore?
Screenshots are encouraged!
Upload your screenshot to tinypic and post the link here.
The link: http://i48.tinypic.com/2uszn81.jpg
The character is jumping only once when its not in the gray line, after its stops in the gray line, it cant jump any more...
Offline
Auto007 wrote:
GlennWright wrote:
Maybe use cloud variables and date blocks in the upcoming Scratch 2.0? I've tested the features- they are a lot easier and more convenient for this script.
Thanks i was hoping for this.
Well, In 2.0 is there any command like -repeat until [I recieve "bradcast"] end [or] if [I recieve "bradcast"] end
Sorry about the late reply, but heres what Lightnin had to say to me about broadcasting.
Thanks, Glen! This has been a popular suggestion for a while now. The issue with repeat until “Broadcast” is that a broadcast is an instantaneous thing - and you can have more than one. It's not something whose state changes after it happens - like a variable.
We could make a repeat until broadcast check to see if the broadcast has happened since the last start of the repeat loop, but it kind of muddies the concept. So for now, the best way to tackle this is to have the broadcast set a variable, and have the repeat while loop check it before repeating.
Offline
Pharosz wrote:
Blazingwave wrote:
Pharosz wrote:
HI!
I have a problem with jumping. I copied the script from wiki "Physically accurate jumping".
It is jumping only once and when touching the color I added it stops and cant jump any more. Can you help what is the problem?
Thanks!Maybe it was an old article from the wiki and doesn't work anymore?
Screenshots are encouraged!
Upload your screenshot to tinypic and post the link here.The link: http://i48.tinypic.com/2uszn81.jpg
The character is jumping only once when its not in the gray line, after its stops in the gray line, it cant jump any more...
Well you could've used the forum's built-in scratchblocks creator, which I explain how to use here in this guide.
Anyway, I'll look at your code when I can; I have to go right now.
Offline
ErnieParke wrote:
Pharosz wrote:
Blazingwave wrote:
Maybe it was an old article from the wiki and doesn't work anymore?
Screenshots are encouraged!
Upload your screenshot to tinypic and post the link here.The link: http://i48.tinypic.com/2uszn81.jpg
The character is jumping only once when its not in the gray line, after its stops in the gray line, it cant jump any more...Well you could've used the forum's built-in scratchblocks creator, which I explain how to use here in this guide.
Anyway, I'll look at your code when I can; I have to go right now.
Actually, I've just realized that I do have a bit of time. So, in your script that looks like this:
when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) say [Hello] for (1) secs repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
Offline
ErnieParke wrote:
ErnieParke wrote:
Pharosz wrote:
The link: http://i48.tinypic.com/2uszn81.jpg
The character is jumping only once when its not in the gray line, after its stops in the gray line, it cant jump any more...Well you could've used the forum's built-in scratchblocks creator, which I explain how to use here in this guide.
Anyway, I'll look at your code when I can; I have to go right now.Actually, I've just realized that I do have a bit of time. So, in your script that looks like this:
when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
Could you change to this and tell me if your character says "Hello" on jumps past the first one?when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) say [Hello] for (1) secs repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
If you're wondering, this is just a test to see if what I suspect is true.
Now it can jump as many times as I want, only problem it is jumping too big, to the top of the screen Whats that?
Offline
Is there any way to overlay sprites? What I mean is, if you're making an angry birds like game and you make your level with one colour as a bottom surface another as a left surface e.t.c. and then use if touching colour to make your sprite bounce off the sides, can you then put another sprite (what the level should actually look like) on top and still keep the if touching colour?
Offline
Pharosz wrote:
ErnieParke wrote:
ErnieParke wrote:
Well you could've used the forum's built-in scratchblocks creator, which I explain how to use here in this guide.
Anyway, I'll look at your code when I can; I have to go right now.Actually, I've just realized that I do have a bit of time. So, in your script that looks like this:
when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
Could you change to this and tell me if your character says "Hello" on jumps past the first one?when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) say [Hello] for (1) secs repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
If you're wondering, this is just a test to see if what I suspect is true.Now it can jump as many times as I want, only problem it is jumping too big, to the top of the screen Whats that?
Well I think that's being caused by setting your y value to to large of a number. 4~7 would probably be better in our case. Also, I think that replacing the [say [Hello] for (1) secs] with [wait (0) secs] would work, if you want to change that.
Offline
ErnieParke wrote:
Pharosz wrote:
ErnieParke wrote:
Actually, I've just realized that I do have a bit of time. So, in your script that looks like this:when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
Could you change to this and tell me if your character says "Hello" on jumps past the first one?when gf clicked forever if <(key [up arrow v] pressed?) and <(Y Speed) = (0)>> set [Y Speed v] to (9) say [Hello] for (1) secs repeat until (touching color [#909090]?) change [Y Speed v] by (-0.5) end set [Y Speed v] to (0) end
If you're wondering, this is just a test to see if what I suspect is true.Now it can jump as many times as I want, only problem it is jumping too big, to the top of the screen Whats that?
Well I think that's being caused by setting your y value to to large of a number. 4~7 would probably be better in our case. Also, I think that replacing the [say [Hello] for (1) secs] with [wait (0) secs] would work, if you want to change that.
Great now it works fine!
So it was a bug in scratch?
Thank you very much
Offline
Pharosz wrote:
ErnieParke wrote:
Pharosz wrote:
Now it can jump as many times as I want, only problem it is jumping too big, to the top of the screen Whats that?Well I think that's being caused by setting your y value to to large of a number. 4~7 would probably be better in our case. Also, I think that replacing the [say [Hello] for (1) secs] with [wait (0) secs] would work, if you want to change that.
Great now it works fine!
So it was a bug in scratch?
Thank you very much
No; actually it was more of a problem with how your script was built. So, when you jump your second time, you set (Y Velocity) to 9, Scratch sees that you're touching grey, so it doesn't run the loop, and it sets (Y Velocity) back to 0. Then, it runs the scripts that moves your character and moves it 0 pixels up/down because (Y Velocity) is 0! So, with the addition of the wait block, Scratch will actually move your character each jump before it starts the repeat loop, clearing things up.
Anyway, your welcome!
Offline
shadowmouse wrote:
Is there any way to overlay sprites? What I mean is, if you're making an angry birds like game and you make your level with one colour as a bottom surface another as a left surface e.t.c. and then use if touching colour to make your sprite bounce off the sides, can you then put another sprite (what the level should actually look like) on top and still keep the if touching colour?
I don't think that is possible.
Offline
Is there any way that I could make the same sort of effect?
As in, the level that is done purely functionally with a better looking version on top?
Offline
I am having login issues, so I can't save. Here is my dilemma; I get to the part that says login to save. I have changed my password, updated my email and every time I try to login, it says invalid username and password. But, when I am working on my script it says welcome despadron. I am totally confused.
Offline
despadron wrote:
I am having login issues, so I can't save. Here is my dilemma; I get to the part that says login to save. I have changed my password, updated my email and every time I try to login, it says invalid username and password. But, when I am working on my script it says welcome despadron. I am totally confused.
Great question! But you will get a lot more help if you ask on the bugs and glitches section of the forums Admins answer questions there such as these sort of issues!
Offline
I would like to join, i'm not that good, but i can definetly answer some questions. But if i join, will my questions still be answered? Because i'm currently working on a complicated game and i may need some help....
Offline
funnymee323 wrote:
I would like to join, i'm not that good, but i can definetly answer some questions. But if i join, will my questions still be answered? Because i'm currently working on a complicated game and i may need some help....
Well, you don't need to be a member to ask questions; why you can ask them at any moment and have your questions answered with a nice reply! Also, you don't need to be good to join, you just need to ask to join. So you're in.
Offline
shadowmouse wrote:
Is there any way that I could make the same sort of effect?
As in, the level that is done purely functionally with a better looking version on top?
Well, yes, and it might be the way that you mentioned earlier because I've been the editor for a game that's similar to this and that also uses some similar concepts, though I haven't gone too in depth, so I'm not exactly sure about how the game does this, so it might not work for you. It'll go look a bit deeper soon, and tell you what I see.
Offline