This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-11-04 02:41:15

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

A Turnable reflection script?

Ok, so I am making a scratch game based on a cartoon network game I used to play a llllloooooooooonnnnnnnngggggg time ago. (link to game)
Well, I have all of the sprites and such done, I just need help on what script to use,

When the laser hit's the mirror, how would I make it reflect in the direction shown.
Be precise, unlike Laser Lab, I am considering lots more things, like where on the mirror I hit, and precise angles (e.g. -39, 44, 180, litterally anything... between the range of 0 - 360).

    Regards,
       Ralphj
os

Last edited by Ralphjos (2009-11-04 02:42:06)


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#2 2009-11-04 21:35:08

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: A Turnable reflection script?

Here is a link to my pong game.
http://scratch.mit.edu/projects/Locomule/737050

It uses true reflections as well as influenced reflections. By that I mean the paddles figure true reflections and then adjust them according to how far the ball bounces from the center of the paddle (which coincidentally could be used to figure bounce reflections off of a round mirror/object.) Of course, you would have to adapt it but if you need any help, just let me know and I'll be glad to help with suggestions, scripting, or whatever.  smile

Last edited by Locomule (2009-11-04 21:35:39)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#3 2009-11-04 23:23:15

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

Dannnngggg That's confusing!!

Sorry if it's a pain Loco, but can you explain it to me? And lets say the paddle is at 45 degrees (also including -135), can you give me an example using that?  big_smile

    Regards,
       Ralphj
os

Last edited by Ralphjos (2009-11-04 23:24:07)


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#4 2009-11-06 01:09:06

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: A Turnable reflection script?

Well, technically the running script has no idea what angle the paddle is at visually. So lets say you used a 0 degree (or straight up and down) paddle as a 'normal' bounce. As the paddle rotates, in this case to 45 degrees, you just adjust the figured 'normal' angle by the additional 45 degrees. Same effect as my Pong paddle bounce only it adjusts the 'normal' angle by how far up or down the ball is from the center of the paddle. Now you will adjust the 'normal' bounce angle by how far the paddle itself is rotated. I will make a script for this. I agree, it is confusing enough to script and talking about it can be even worse, lol. Will post back here when it is finished and uploaded. I have to work all day tomorrow so it might take me a bit but I will shoot for tomorrow night if I can. I'd go for tonight but I was up at 4:30AM this morning and worked till 5:00 pm... SO TIRED!!! Peace.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#5 2009-11-06 01:25:01

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

Locomule wrote:

Well, technically the running script has no idea what angle the paddle is at visually. So lets say you used a 0 degree (or straight up and down) paddle as a 'normal' bounce. As the paddle rotates, in this case to 45 degrees, you just adjust the figured 'normal' angle by the additional 45 degrees. Same effect as my Pong paddle bounce only it adjusts the 'normal' angle by how far up or down the ball is from the center of the paddle. Now you will adjust the 'normal' bounce angle by how far the paddle itself is rotated. I will make a script for this. I agree, it is confusing enough to script and talking about it can be even worse, lol. Will post back here when it is finished and uploaded. I have to work all day tomorrow so it might take me a bit but I will shoot for tomorrow night if I can. I'd go for tonight but I was up at 4:30AM this morning and worked till 5:00 pm... SO TIRED!!! Peace.

Thanks so much for helpin me Loco~!

    Regards,
       Ralphj
os


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#6 2009-11-07 05:44:47

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: A Turnable reflection script?

Don't thank me yet! I just stayed up all night typing possibly the longest single forum reply in the history of Forums and so got nothing done for you! Sorry. But I have not forgotten about this and will get to it soon, I promise.

Oh yeah, cheddargirl has inspired me to create quite a bizarre little game that will no doubt send countless children to the utter depths of socially depravity through its usage of simulated violence. Awful hard to keep THAT on the back shelf, eh?


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#7 2009-11-10 17:57:36

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

--bump--


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#8 2009-11-10 18:08:26

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: A Turnable reflection script?

Don't blame you for bumping but just so you know, I recently started bookmarking all the stuff I am helping or involved with so I will be back. Just taking longer than I anticipated as my band just cranked back up and I do a lot of volunteer work AND have almost random work hours.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#9 2009-11-10 21:06:56

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

Locomule wrote:

Don't blame you for bumping but just so you know, I recently started bookmarking all the stuff I am helping or involved with so I will be back. Just taking longer than I anticipated as my band just cranked back up and I do a lot of volunteer work AND have almost random work hours.

What would I do without you...  smile

    Regards,
       Ralphj
os


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#10 2009-11-13 03:36:43

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: A Turnable reflection script?

I checked out the original version of this game and now I have a completely different answer for you. You don't want to do this because it would make the game impossible.

In the original version of this game there are 8 different angles for each mirror. Every additional angle (actually 4 angles) that you add not only becomes more difficult to draw (and be seen/judged correctly) but in multiple ways makes the game too hard. If you made a mirror that rotated through 360 angles, imagine how impossible it would become to line up subsequent mirror bounces? More than 2 or 3 mirrors, especially over long distances, would be more like guess work than anything. Does this make sense? The player couldn't tell for sure even what angle even a single mirror was aiming, I don't think.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#11 2009-11-13 09:46:41

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: A Turnable reflection script?

Here you go  big_smile  http://scratch.mit.edu/projects/Magnie/701486  big_smile

Offline

 

#12 2009-11-13 10:37:12

Ralphjos_LT_Acc
Scratcher
Registered: 2009-11-11
Posts: 12

Re: A Turnable reflection script?

Locomule wrote:

I checked out the original version of this game and now I have a completely different answer for you. You don't want to do this because it would make the game impossible.

In the original version of this game there are 8 different angles for each mirror. Every additional angle (actually 4 angles) that you add not only becomes more difficult to draw (and be seen/judged correctly) but in multiple ways makes the game too hard. If you made a mirror that rotated through 360 angles, imagine how impossible it would become to line up subsequent mirror bounces? More than 2 or 3 mirrors, especially over long distances, would be more like guess work than anything. Does this make sense? The player couldn't tell for sure even what angle even a single mirror was aiming, I don't think.

Then just 4 angles? I can do that...
*Edit: I made it 8 angles: 0, 45, 90, 135, 180, -135, -90, and -45

Magnie wrote:

Here you go    http://scratch.mit.edu/projects/Magnie/701486

Thank you so much Magnie! I'll implement this into my project and see if it works.

    Regards,
       Ralphj
os

Last edited by Ralphjos_LT_Acc (2009-11-13 19:36:07)

Offline

 

#13 2009-11-13 11:04:38

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: A Turnable reflection script?

All is welcome!  big_smile  ( My saying, no usy.  wink  )

Offline

 

#14 2009-11-13 19:31:18

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

Sorry Magnie, but that script doesn't work.

Here is the demo...

    Regards,
       Ralphj
os


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#15 2009-11-13 23:51:34

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Re: A Turnable reflection script?

Well lets see...
um...
maybe you could put:
When I receive start
Point towards sprite 1
pen down
move (distant to sprite 1) steps

Offline

 

#16 2009-11-14 00:01:05

adriangl
Scratcher
Registered: 2007-07-02
Posts: 1000+

Re: A Turnable reflection script?

Ralphjos wrote:

Sorry Magnie, but that script doesn't work.

Here is the demo...

    Regards,
       Ralphj
os

When I tried out the demo there was no reflection when the beam hit something. Are you still working on it?


Scratchin' since 2007

Offline

 

#17 2009-11-14 06:27:51

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: A Turnable reflection script?

adriangl wrote:

Ralphjos wrote:

Sorry Magnie, but that script doesn't work.

Here is the demo...

    Regards,
       Ralphj
os

When I tried out the demo there was no reflection when the beam hit something. Are you still working on it?

Yes, there is no reflection because I couldn't find an appropreate one that fit. Magnie suggested using costumes, but I've been busy lately that I haven't had enough time to set one up.

    Regards,
       Ralphj
os


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

Board footer