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

#1 2010-05-29 08:21:09

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

I need help with some code... And yes, this is advanced...

I need a laser that spins, emitted from a baddie.

Simple enough, right?

Well, I need the laser to not be able to go through, let's say, blue.

How would I get this to work?

Example:

    OTHER STUFF       WALL ->  |------LASER--------

Oh, and stretch blocks can be used...


http://i46.tinypic.com/dw7zft.png

Offline

 

#2 2010-05-29 08:57:03

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Have a look at the code for this: http://scratch.mit.edu/projects/calebxy/1082094
It's basically the same thing. Look at the code for the Daleks and the laser.


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#3 2010-05-29 09:09:52

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Yes, but the laser must spin fast...


http://i46.tinypic.com/dw7zft.png

Offline

 

#4 2010-05-29 11:48:06

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

What do you mean spin fast? Could you upload a demo?


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#5 2010-05-29 12:09:29

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

http://scratch.mit.edu/projects/SeptimusHeap/1084202

Uh... Yeah. I want that to not be able to beam through the color blue.


http://i46.tinypic.com/dw7zft.png

Offline

 

#6 2010-05-29 12:41:44

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Download this: http://scratch.mit.edu/projects/calebxy/1084269

I have made the blue ball "draggable on website" as the makers of scratch say.


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#7 2010-05-29 13:32:29

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Ok, I've edited Calebxy's version so that the ball now blocks it, but doesn't stop the laser moving. Like a wall would.
http://scratch.mit.edu/projects/markyparky56/1084374


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#8 2010-05-29 13:37:04

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

That's what I wanted...


http://i46.tinypic.com/dw7zft.png

Offline

 

#9 2010-05-29 13:38:25

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Ooh... I wanted it to work from any distance, like, say, right next to the shooter...


http://i46.tinypic.com/dw7zft.png

Offline

 

#10 2010-05-29 13:55:02

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Done it. http://scratch.mit.edu/projects/calebxy/1084431


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#11 2010-05-29 16:52:31

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

If only it worked faster... I did basically what calebxy did before I posted this thread... But I could never make it FASTER...

And I wish the laser wouldn't 'emit' from the center, just move in a circle, like my first project...

Last edited by SeptimusHeap (2010-05-29 16:53:32)


http://i46.tinypic.com/dw7zft.png

Offline

 

#12 2010-05-29 17:00:06

calebxy
Scratcher
Registered: 2009-12-31
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

I don't think I can do any better. I might try a bit later though.


I'm making my own Doctor Who series!  big_smile  See the first episode here.
And please join Story Zone!  big_smile

Offline

 

#13 2010-05-29 17:05:34

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Screw faster...

I just want smooth spinning, no 'emitting'...


http://i46.tinypic.com/dw7zft.png

Offline

 

#14 2010-05-29 17:14:39

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

The way posted is already the best way to do things unless you just want a static bar. You can't make a proper lazer because scratch adds a lag after every block.

This one doesn't crawl like a bug but its still slow http://scratch.mit.edu/projects/archtest/1084810

Last edited by archmage (2010-05-29 17:16:21)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#15 2010-05-29 17:29:56

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

archmage wrote:

The way posted is already the best way to do things unless you just want a static bar. You can't make a proper lazer because scratch adds a lag after every block.

This one doesn't crawl like a bug but its still slow http://scratch.mit.edu/projects/archtest/1084810

Sweet! I tried, but mine is crawl-slow...


http://i46.tinypic.com/dw7zft.png

Offline

 

#16 2010-05-29 17:38:44

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

ANy way to make a custom block in smalltalk to do it?

It's in Panther, which has Code Your Own Block (CYOB).


http://i46.tinypic.com/dw7zft.png

Offline

 

#17 2010-05-29 17:55:38

PlayWithFire
Scratcher
Registered: 2010-01-20
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

the onyl way to make it smoother would to be if the color was always in the same spot.  is the color able to move or is it always in the same area?


http://scratch.mit.edu/static/projects/PlayWithFire/1610180_sm.png
Check out the DG Games Website For the latest news on games like Infected

Offline

 

#18 2010-05-29 18:00:30

PlayWithFire
Scratcher
Registered: 2010-01-20
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

try archmage's method only with turn 10 degrees and set pen size to 5, and move 20 steps instead of ten, that'll speed it up even though it senses a little worse.


http://scratch.mit.edu/static/projects/PlayWithFire/1610180_sm.png
Check out the DG Games Website For the latest news on games like Infected

Offline

 

#19 2010-05-29 18:07:13

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

The way I see is use
forever
| if <touching blue>
||repeat until <not<touching blue>>
||| change stretch by (-1)
|________________________________
|broadcast 'move' and wait
_________________________________

Then have:

When I recive 'move'
clear graphic effects
Rotate (the current move script)


You can now reach me on Twitter @johnnydean1_

Offline

 

#20 2010-05-30 04:20:41

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Just tried a way using strech blocks and it works, but it could be improved.
http://scratch.mit.edu/projects/johnnydean1/1085834
you must download

Last edited by johnnydean1 (2010-05-30 04:33:41)


You can now reach me on Twitter @johnnydean1_

Offline

 

#21 2010-05-30 08:17:27

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

I don't think this has been said yet but why don't you use stamp blocks and make it go really fast?


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#22 2010-05-30 08:18:56

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

ScratchReallyROCKS wrote:

I don't think this has been said yet but why don't you use stamp blocks and make it go really fast?

An example?


http://i46.tinypic.com/dw7zft.png

Offline

 

#23 2010-05-30 08:27:58

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Hmm... How about using 'distance to sprite' blocks...?


http://i46.tinypic.com/dw7zft.png

Offline

 

#24 2010-05-30 10:55:15

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

Looked at my example?


You can now reach me on Twitter @johnnydean1_

Offline

 

#25 2010-05-30 11:34:55

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: I need help with some code... And yes, this is advanced...

johnnydean1 wrote:

Looked at my example?

Yes, I just don't like the part where it moves up like that...

And if it could be faster...


http://i46.tinypic.com/dw7zft.png

Offline

 

Board footer