Hard for me to explain... here we go:
Does anyone have the blocks to move a spaceship forward (constantly at the speed) in the direction the ship is facing BUT the speed of the ship gets slightly faster the longer you hold the direction key (up to a certain max speed).
So when i tap the forward key- the ships moves slightly (keeps moving at that speed)
but if i tap the key again- it will go slightly faster (and remain at the same speed) until a certain speed. Likewise if you hold the forward key down it will get faster until a certain speed or if you let go of the forward key...
If you can understand this then is it possible?
Offline
when gf clicked set [speed v] to (0) forever if <key [right arrow v] pressed?> turn cw (5) degrees end if <key [left arrow v] pressed?> turn ccw (5) degrees end if <key [up arrow v] pressed?> change [speed v] by (0.1) // bigger = faster end if <(speed) > (max speed)> set [speed v] to (max speed) end move (speed) steps
Last edited by MoreGamesNow (2012-07-27 20:51:13)
Offline
Hello
Keep gettin stuck on the movement of my ship heh. Is there any blocks that move the ship so when u hit the forward key/ backwards- you move in that direction constantly but you can still rotate left and right while the ship is still moving forward.
For instance while the ship is moving constantly in this direction: --> I can turn left and right while moving the same direction: -->
Thanx
Offline
Here is a script that may help you
Just lock the sprite to avoid the ship going upside down!
when gf clicked forever if <key [right arrow v] pressed?> point in direction (90 v) move (10) steps end if <key [left arrow v] pressed?> point in direction (-90 v) move (10) steps end if <key [up arrow v] pressed?> point in direction (0 v) move (10) steps end if <key [down arrow v] pressed?> point in direction (180 v) move (10) steps end end
Offline
daniel_j wrote:
Here is a script that may help you
Just lock the sprite to avoid the ship going upside down!when gf clicked forever if <key [right arrow v] pressed?> point in direction (90 v) move (10) steps end if <key [left arrow v] pressed?> point in direction (-90 v) move (10) steps end if <key [up arrow v] pressed?> point in direction (0 v) move (10) steps end if <key [down arrow v] pressed?> point in direction (180 v) move (10) steps end
Fixed your forever loop.
Offline
Hmm i really appreciate the help and thanx but every time i press the foward key- i would like to move foward in the direction that the ship is pointing + it moves in that direction constantly but at the same time i can move my ship left and right.
Hard to explain so.... if my ship was pointing <---- i hit the forward key and it will move slowly in that direction constantly (and at the same time i can still rotate without it affecting the direction that the ship is moving until i hit forward again- when it moves forward in that direction)
So hard to explain- but when i use (move [steps]) and repeat- it moves in the direction but when i turn right or left- the movement of the ship is also changed to that direction.
Thanx for ur efforts- i know this ones complicated because ive tried in different ways...
If you still don't understand what i'm tryin to achieve- its ship movement exactly like this: http://scratch.mit.edu/projects/maayax/2692420but mayb its the background thats moving and not the ship
Offline
Sorry i meant like this video: http://www.scratch.mit.edu/ext/youtube/?v=_ucp8AoyM74&feature=relmfu (the ships and the controls/ bombs is what im intending to make in a 1 vs 1 duel game on scratch)
Thanks for your efforts lol
Offline
Is this what you mean?
make a variable direction
when gf clicked forever if <key [up arrow v] pressed?> point in direction (direction) move (10) steps end if <key [left arrow v] pressed?> turn cw (15) degrees set [direction v] to (direction) end if <key [right arrow v] pressed?> turn ccw (15) degrees set [direction v] to (direction) end end
Offline
ok hehe i'll wait... really appreciate it lol... i'm just staring at my screen with a headache about figuring it out. Thought i could recreate that ship based on that video i showed u but turns out its taking forever... i've made the bomb bounce once and explode but its the ship control is one of the major problems lol
Gonna try and make it player 1 vs player 2... then have different arenas to pick from... want me to publish what ive done so far so u can see where im coming from?
Offline
The turning of the ship is fine at the setting of: When clicked- forever if key Left is pressed - turn <- 5 degrees and right -> degrees...
Its just the forward and backwards bit... just getting it to glide when i hit the forwards or backwards key but can still rotate left and right at the same time
Offline
Subsidel wrote:
The turning of the ship is fine at the setting of: When clicked- forever if key Left is pressed - turn <- 5 degrees and right -> degrees...
Its just the forward and backwards bit... just getting it to glide when i hit the forwards or backwards key but can still rotate left and right at the same time
Do you want the ship to move the direction you are pointing?
Offline
Ok here it is http://scratch.mit.edu/projects/Subsidel/2700928
1) Yeh i want the ship to glide only forwards or backwards (so u can still rotate while the ship is moving in 1 direction- until u hit the forward or backwards key again where u will glide in the new direction)..... the rotate keys is ok as it is
2) Once its done...If this is possible- i'll try and figure out how to add speed gradually to the ship so the longer you press the forward or backwards key the faster the ship moves in that direction until a set speed lol. (so complicated lol)
Offline
Well i actually thought i was gettin close to sorting the controls out- with a massive script i made the ship constantly move forward + gets slightly faster the longer i held the forward key up until a set max speed but every turn would make the ship move in that direction .
Basically you point in a direction- hit forward/ backwards key: u move in that direction but if u let go of the forward key- u keep moving at the same speed and u can rotate + the ship will still remain moving in same direction until u point in a new direction and hit the forwards key..
so complicated to explain but simple in my head.
Offline