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

#1 2012-11-09 08:43:59

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Ugh.

My sprite cannot sense when it is touching the color red, and it won't reset after it touches grey. Any idea why?  sad

here


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#2 2012-11-09 08:58:37

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Ugh.

It looks to me like you're rendering the target AFTER checking to see if you're touching red (see below).

What you're doing:

Code:

forever
     clear
     check if touching red  // impossible since you cleared the red target that was rendered last frame
     render red
end

http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-11-09 09:31:13

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

MoreGamesNow wrote:

It looks to me like you're rendering the target AFTER checking to see if you're touching red (see below).

What you're doing:

Code:

forever
     clear
     check if touching red  // impossible since you cleared the red target that was rendered last frame
     render red
end

Why do I fail so much?  tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#4 2012-11-09 09:33:28

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

Also, can you figure out why the arrow won't reset? Or why the target keeps disappearing?


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#5 2012-11-10 10:20:22

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

bumpehbumpeh


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#6 2012-11-10 12:05:59

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: Ugh.

bluergh my brain hurts but my guess is that the script wont reset the arrow because it got to finish the loop first?


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#7 2012-11-10 12:18:16

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Ugh.

I "showed" the sprite continuously (instead of only when it should appear) and it never actually touches the gray line.  It is also hidden when you do the sensing, which I believe means that it will always return false anyway.

http://i47.tinypic.com/2vwbng8.png


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#8 2012-11-10 12:22:03

MoreWillpower
Scratcher
Registered: 2012-05-08
Posts: 89

Re: Ugh.

mythbusteranimator wrote:

MoreGamesNow wrote:

It looks to me like you're rendering the target AFTER checking to see if you're touching red (see below).

What you're doing:

Code:

forever
     clear
     check if touching red  // impossible since you cleared the red target that was rendered last frame
     render red
end

Why do I fail so much?  tongue

Seems like everytime i check you are asking something on help with scripts  tongue


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i47.tinypic.com/2yv5usx.png&link2=http://i47.tinypic.com/21brcr4.jpg

Offline

 

#9 2012-11-10 12:22:59

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

MoreWillpower wrote:

mythbusteranimator wrote:

MoreGamesNow wrote:

It looks to me like you're rendering the target AFTER checking to see if you're touching red (see below).

What you're doing:

Code:

forever
     clear
     check if touching red  // impossible since you cleared the red target that was rendered last frame
     render red
end

Why do I fail so much?  tongue

Seems like everytime i check you are asking something on help with scripts  tongue

It is because everything works out perfectly in my head, but it doesn't work when i PUT IT TO USE.  tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#10 2012-11-10 12:24:44

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: Ugh.

MoreGamesNow wrote:

I "showed" the sprite continuously (instead of only when it should appear) and it never actually touches the gray line.  It is also hidden when you do the sensing, which I believe means that it will always return false anyway.

http://i47.tinypic.com/2vwbng8.png

if it is not sensing grey then you need to check your script, make sure it is set to sense the right colour as well


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#11 2012-11-10 12:24:52

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

MoreGamesNow wrote:

I "showed" the sprite continuously (instead of only when it should appear) and it never actually touches the gray line.  It is also hidden when you do the sensing, which I believe means that it will always return false anyway.

http://i47.tinypic.com/2vwbng8.png

Wait...is it going too fast, so it just skips right over the grey area?


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#12 2012-11-10 13:55:48

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: Ugh.

mythbusteranimator wrote:

MoreGamesNow wrote:

I "showed" the sprite continuously (instead of only when it should appear) and it never actually touches the gray line.  It is also hidden when you do the sensing, which I believe means that it will always return false anyway.

http://i47.tinypic.com/2vwbng8.png

Wait...is it going too fast, so it just skips right over the grey area?

hmm

that is actually possible - set the arrow speed slower?


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#13 2012-11-10 14:09:58

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Ugh.

Or set it slower when it gets within a certain distance of the target, that way it won't affect the simulation/animation as much.


Be nice, I'm an old lady  wink

Offline

 

#14 2012-11-10 14:23:55

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Ugh.

mythbusteranimator wrote:

MoreGamesNow wrote:

I "showed" the sprite continuously (instead of only when it should appear) and it never actually touches the gray line.  It is also hidden when you do the sensing, which I believe means that it will always return false anyway.

http://i47.tinypic.com/2vwbng8.png

Wait...is it going too fast, so it just skips right over the grey area?

I think the problem is more along these lines:
When you draw the arrow near the right side of the screen, the tip of your arrow ends up too far right, so that, when you sense to see if you're touching the line, your "bow" (the costume you're using to see if you're touching the gray line) is too far right.

Essentially: your bow can only go so far off the screen, and you're reaching that limit when you draw the arrow so that, when you move the bow back to its "sensing position", it isn't far enough right.


The above is just speculation, but I think it is much more likely that that is the problem than that you're "skipping" over the gray line (since you never actually end up past it anyway).  That being said, "skipping" may become a problem once this one is resolved.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#15 2012-11-10 17:02:05

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Ugh.

OK, I've downloaded your project and had a quick look at it.
Why is it all one script? I can understand why you might want to make a one-sprite game, but I'm not sure why you'd want just the one script. It'd be a lot easier (and would probably run faster if you broke the script up into chunks (and it would be ten times easier if you used more sprites!)
For your script:
1. You need to use 'colour X is touching colour Y?' instead of 'touching colour X?' because your sprite is permanently moving and redrawing, and is also mainly 'hidden'.
2. I think the reason it still doesn't sense if it's touching the colour is because the screen is 'refreshing' to often. Try moving it somewhere else. I tried putting it after the 'if shot = 1' block.
Although buggy, the arrow stopped if it touched the red target.
I couldn't get the 'if touching grey' block to work, so I suggest you replace that with a 'if arrowx > X1: set arrowx to X2". I haven't had a proper look at the code, but that might work.
Again, I haven't really looked to see if you can, but try and see if you can lighten the code a bit, it's very long and bloated.

Otherwise, it's a very ingenious project! Good luck  wink

Edit: I've just noticed the title of the project '1s1s1c' - I'm guessing that means 1 sprite, 1 script, 1 c-something? In that case, I guess you won't be wanting to split the script into several parts. I still recommend you try and figure out some ways to lighten the script, if at all possible. Maybe trying using lists? Again, I don't know if that"ll work, I haven't looked properly at the entirety of the script.

Last edited by Llamalover (2012-11-10 17:06:07)


Be nice, I'm an old lady  wink

Offline

 

#16 2012-11-10 19:46:24

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Ugh.

Llamalover wrote:

OK, I've downloaded your project and had a quick look at it.
Why is it all one script? I can understand why you might want to make a one-sprite game, but I'm not sure why you'd want just the one script. It'd be a lot easier (and would probably run faster if you broke the script up into chunks (and it would be ten times easier if you used more sprites!)

...

Edit: I've just noticed the title of the project '1s1s1c' - I'm guessing that means 1 sprite, 1 script, 1 c-something? In that case, I guess you won't be wanting to split the script into several parts. I still recommend you try and figure out some ways to lighten the script, if at all possible. Maybe trying using lists? Again, I don't know if that"ll work, I haven't looked properly at the entirety of the script.

I find the easiest ways to code 1s1s is to break the code into pieces and use something like this:

when gf clicked
broadcast [initialize v] and wait
forever
broadcast [part1 v] and wait
broadcast [part2 v] and wait
broadcast [part3 v] and wait
It just makes it easier to organize and faster to edit the scripts.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#17 2012-11-10 20:47:24

KrIsMa
Scratcher
Registered: 2011-09-20
Posts: 500+

Re: Ugh.

Please choose a name that actually says something about this post. Thanks!


http://blocks.scratchr.org/API.php?user=KrIsMa&action=onlineStatus&online=http://i49.tinypic.com/2pzic0m.png&offline=http://i49.tinypic.com/r7p10n.png
The Scratch Team (and fellow scratchers!) is/are so nice!!!

Offline

 

#18 2012-11-13 16:02:40

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Ugh.

Well, any luck? Have you got everything working?


Be nice, I'm an old lady  wink

Offline

 

#19 2012-11-28 10:50:15

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Ugh.

MoreGamesNow wrote:

Llamalover wrote:

OK, I've downloaded your project and had a quick look at it.
Why is it all one script? I can understand why you might want to make a one-sprite game, but I'm not sure why you'd want just the one script. It'd be a lot easier (and would probably run faster if you broke the script up into chunks (and it would be ten times easier if you used more sprites!)

...

Edit: I've just noticed the title of the project '1s1s1c' - I'm guessing that means 1 sprite, 1 script, 1 c-something? In that case, I guess you won't be wanting to split the script into several parts. I still recommend you try and figure out some ways to lighten the script, if at all possible. Maybe trying using lists? Again, I don't know if that"ll work, I haven't looked properly at the entirety of the script.

I find the easiest ways to code 1s1s is to break the code into pieces and use something like this:

when gf clicked
broadcast [initialize v] and wait
forever
broadcast [part1 v] and wait
broadcast [part2 v] and wait
broadcast [part3 v] and wait
It just makes it easier to organize and faster to edit the scripts.

I haven't done the suggestions yet, because I have been busy.
But I will try them now.
(and I try to do 1s1s1c because they are more challenging and cooler.  cool )


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#20 2012-11-28 14:11:30

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Ugh.

mythbusteranimator wrote:

MoreGamesNow wrote:

Llamalover wrote:

OK, I've downloaded your project and had a quick look at it.
Why is it all one script? I can understand why you might want to make a one-sprite game, but I'm not sure why you'd want just the one script. It'd be a lot easier (and would probably run faster if you broke the script up into chunks (and it would be ten times easier if you used more sprites!)

...

Edit: I've just noticed the title of the project '1s1s1c' - I'm guessing that means 1 sprite, 1 script, 1 c-something? In that case, I guess you won't be wanting to split the script into several parts. I still recommend you try and figure out some ways to lighten the script, if at all possible. Maybe trying using lists? Again, I don't know if that"ll work, I haven't looked properly at the entirety of the script.

I find the easiest ways to code 1s1s is to break the code into pieces and use something like this:

when gf clicked
broadcast [initialize v] and wait
forever
broadcast [part1 v] and wait
broadcast [part2 v] and wait
broadcast [part3 v] and wait
It just makes it easier to organize and faster to edit the scripts.

I haven't done the suggestions yet, because I have been busy.
But I will try them now.
(and I try to do 1s1s1c because they are more challenging and cooler.  cool )

Of course.  I use the above script while my 1s1s projects are in development, and then just stick them all together at the end.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer