Hi,
I'm curious to know how you can get the speed or velocity of a sprite.
Regards,
CAA14
Offline
CAA14 wrote:
Hi,
I'm curious to know how you can get the speed or velocity of a sprite.
Regards,
CAA14
Well, this is actually quite simple, if you do you're movement one way. First, you'll need to create two variables for a sprite called "X Velocity" and "Y Velocity". Then, just do this to move your sprite:
when gf clicked forever change x by (X Velocity) change y by (Y Velocity)
([sqrt v] of (((X Velocity) * (X Velocity)) + ((Y Velocity) * (Y Velocity))))
Last edited by ErnieParke (2013-01-31 16:45:46)
Offline
Hi,
Thanks for responding.
Thanks again.
What actually made me wonder about that was looking at your project.
One reason i ask is that i would also like to make a forever running game to the right, and i need to know how to scroll and to get velocity for impact of things.
Thanks again,
CAA14
Offline
CAA14 wrote:
Hi,
Thanks for responding.
Thanks again.
What actually made me wonder about that was looking at your project.
One reason i ask is that i would also like to make a forever running game to the right, and i need to know how to scroll and to get velocity for impact of things.
Thanks again,
CAA14
So you're making a scrolling game using velocities, right? Just to make sure, you do now how to do this?
And again, your welcome.
Offline
Well, you see, I am also right now trying to learn Java, and I'm kind of waiting on scratch 2.0. The java stuff is being very uncooperative and scratch 2.0 has several bugs still.
So, I'm not yet making anything, except the very basics of my pacman game.
You see, i don't yet know trigonometry or geometry, so I don't know how to come up with the formulas most other people do. That's why i am asking about using velocity because i need to know how to do things in scratch like you can do in java, like "getHeight" and stuff. I want to be able to "getSpeed" and use that to determine if the player crashes or is just blocked.
Thanks again, and could you please post that article about scrolling you were talking about? I looked at one and it was confusing...
CAA14
Offline
CAA14 wrote:
Well, you see, I am also right now trying to learn Java, and I'm kind of waiting on scratch 2.0. The java stuff is being very uncooperative and scratch 2.0 has several bugs still.
So, I'm not yet making anything, except the very basics of my pacman game.
You see, i don't yet know trigonometry or geometry, so I don't know how to come up with the formulas most other people do. That's why i am asking about using velocity because i need to know how to do things in scratch like you can do in java, like "getHeight" and stuff. I want to be able to "getSpeed" and use that to determine if the player crashes or is just blocked.
Thanks again, and could you please post that article about scrolling you were talking about? I looked at one and it was confusing...
CAA14
Interesting; I'm also learning Java.
Anyway, here's the link to the article. If you don't understand it, then you can always ask me to explain scrolling.
Last edited by ErnieParke (2013-01-31 18:39:22)
Offline
Thanks!
BTW, how are you learning java? What compiler are you using?
Also, as an update, since my java projects are having trouble, i am making a never ending run game. I am trying to figure out animating it.
So, this article will come in useful, because the floor is the main thing not finished...
Thanks again,
CAA14
Offline
Well, i did not think ahead, i am not using that velocity thing this time, since the sprite never actually moves.
Well, lets see if i understand that article, if i have problems, I'll post.
Thanks again,
CAA14
Offline
Ok, it's official, i need help. D
I will (hopefully) upload a beta version of my project tomorrow and post the problems.
Regards,
CAA14
Offline
CAA14 wrote:
Thanks!
BTW, how are you learning java? What compiler are you using?
Also, as an update, since my java projects are having trouble, i am making a never ending run game. I am trying to figure out animating it.
So, this article will come in useful, because the floor is the main thing not finished...
Thanks again,
CAA14
Well I am using TextPad, and a teacher at my school is teaching me java, though only the basics. I'll be getting into the "advanced" material next year…
And are you sure you don't want to use X Velocity? This way you can change speeds very easily and realistically, leading to better movement in a lot of situations. Also, you don't need the sprite to be actually moving to be able to use velocities. For example, in quite a few scrollers, the player sprite doesn't move, though it has some sort of velocity.
Anyway, I'll stop by your project tomorrow.
Last edited by ErnieParke (2013-01-31 21:28:00)
Offline
That's realy cool to here about the Java stuff.
I'm also just learning the basics, but i am having tech problems with my compiler that i can't figure out.
Well, if i know how to use velocity, i would.....
I'm going to post it soon,
Regards,
CAA14
Offline
Okay, it's uploaded here.
I listed the goals, so it's all there.
Thanks again,
CAA14
Offline