Discuss Scratch

Notester82
Scratcher
53 posts

Objects 'Warping' Across the Screen

How would a script go to make objects sorta ‘warp’ from one place to another? Like when a ball goes to the right side of the screen, it just ‘warps’ to the left while going in the same direction it went in before. I saw this happen a lot in the Atari game, Asteroids.
coxy5
Scratcher
100+ posts

Objects 'Warping' Across the Screen

when green flag clicked
forever
move (number) steps
if <(x position) > [240]> then
go to x: (-240) y: (y position)
end

This will move it to the left hand side of the screen if it goes off the right. Just add in extra if blocks for the other edges!
tctc1001
New to Scratch
4 posts

Objects 'Warping' Across the Screen

when green flag clicked
move (steps you want to go right) steps
go to x: (x cord of where you want to go left) y: (y cord of where you want to go left)
your done!
coxy5
Scratcher
100+ posts

Objects 'Warping' Across the Screen

link

There is an example of it in practice!
RPFluffy
Scratcher
1000+ posts

Objects 'Warping' Across the Screen

tctc1001 wrote:

when green flag clicked
move (steps you want to go right) steps
go to x: (x cord of where you want to go left) y: (y cord of where you want to go left)
your done!

This won't work ^

Try this:

when green flag clicked
forever
if <<([direction v] of [Sprite1 v]) = [-90]> and <touching [edge v]?>> then
go to x: ((x position) + (240)) y: (y position)
end
if <<([direction v] of [Sprite1 v]) = [90]> and <touching [edge v]?>> then
go to x: ((x position) - (240)) y: (y position)

end
end

Last edited by RPFluffy (July 5, 2014 09:23:48)


Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
Notester82
Scratcher
53 posts

Objects 'Warping' Across the Screen

coxy5 wrote:

link

There is an example of it in practice!

I see..However the bullets aren't able to warp around the playing field no matter how much I change the scripts in my project..Does this mean it's impossible to make them warp?
RPFluffy
Scratcher
1000+ posts

Objects 'Warping' Across the Screen

No, did you try my method?

Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
Notester82
Scratcher
53 posts

Objects 'Warping' Across the Screen

Sorry, forgot to.. I'll try it now..

Edit: Is that script for the Ship or for the Bullets shot from the ship?

Last edited by Notester82 (July 5, 2014 16:29:56)

RPFluffy
Scratcher
1000+ posts

Objects 'Warping' Across the Screen

O.K.

Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
Notester82
Scratcher
53 posts

Objects 'Warping' Across the Screen

(Sorry if it seems like I'm bothering you with these questions..) When I tried adding the script for the Ship, it didn't have an option for it..^
coxy5
Scratcher
100+ posts

Objects 'Warping' Across the Screen

copy the if statements from the asteroids into the bullet and it should then work.
DudmasterUltra
Scratcher
100+ posts

Objects 'Warping' Across the Screen

I made an asteroids game, link in my signature. Here's some simplified code:
forever
if <(x position) < [-239]> then
set x to (240)
end
if <(y position) < [-179]> then
set y to (180)
end
if <(x position) > [239]> then
set x to (-240)
end
if <(y position) > [179]> then
set x to (-180)
end
wait [0.5] secs
end

My Devices
Asus G750JX - 2TB / 16GB RAM / Intel i7 + GeForce GTX 770m / Windows 10
Galaxy S7 Edge - 32GB + 256GB / 4GB RAM / Snapdragon 820 / Android 6.0.1, Stock Unrooted
Galaxy Note 4 - 32GB + 32GB / 3GB RAM / Snapdragon 805 / Android 5.1.1, Stock Unrooted
Google Nexus 9 - 32GB / 2GB RAM / NVIDIA Tegra K1 / Android 6.0.1, Cyanogenmod 13 Rooted
Galaxy Tab S2 - 32GB / 3GB RAM / Exynos 5433 / Android 6.0.1, Stock Rooted + Xposed
Gear Live (Android Wear) - 4GB / 512MB RAM / Snapdragon 400 / Android 6.0.1, Stock Rooted
Fossil Q (Android Wear) - 4GB / 512MB RAM / Intel Atom / Android 6.0.1, Stock
Asus Zenfone 2 - 12GB / 2GB RAM / Intel x86 / Android 6.0.1, Cyanogenmod 13 Rooted
Moto G - 8GB / 1GB RAM / Snapdragon 400 / Android 5.0.2 Stock
(!) Kindle Fire HDX, HD - 32GB / 2GB RAM / Snapdragon 800 / Corrupted operating system
Notester82
Scratcher
53 posts

Objects 'Warping' Across the Screen

..I didn't even know an Asteroids game was on Scratch.. ._. Oh well, guess I'll learn from your game and do stuff to mine.. ^

Powered by DjangoBB