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

#1 2011-12-15 17:54:28

cmp8841
Scratcher
Registered: 2011-06-19
Posts: 31

My scrolling project doesnt work for some reason :(

Im making a scratch game where your a race car, with a moving backround and other racecars going against you. I know how to do moving backrounds and such, and how to make the backround move in certain ways compared to your angle and speed, but my ONLY problem is....
The other racecars that race against you are sopposed to automatically know where to go. I've got that part down. (on how to make them think on their own depending on how the race track looks(where to turn, speed, stay strait)) BUT, how do I get the other cars to go off the screen and have their turning move them in certain directions to make their x and y co-ordinates to make them crash or vear off or speed up in front of you then accidentally shift back behind you.
Right now, My script just makes it seem like paint on the road, because it moves with the backround.

Here is the script I have right now:

<when green flag clicked>
<go to x sad  21 )y sad  61 )
<forever>
<set{ yellow car angle }to( <direction> )
<go to x sad  (( (( <{ ScrollX }> <+> (( <{ yellow car speed }> <*> <sin( <{ yellow car angle }> )) )) <+> 21 )) )y sad  (( (( <{ ScrollX }> <+> (( <{ yellow car speed }> <*> <cos( <{ yellow car angle }> )) )) <+> 61 )) )

Thanks allot!  wink
P.S. this uses allot of trigonomitry and a little of algebra, so if you dont understand those, don't bother, but chanks for stopping by.

Offline

 

#2 2011-12-20 13:31:14

cmp8841
Scratcher
Registered: 2011-06-19
Posts: 31

Re: My scrolling project doesnt work for some reason :(

I guess no one saw this or they don't know trig...

Offline

 

#3 2011-12-20 13:32:35

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: My scrolling project doesnt work for some reason :(

Have them change their scroll variable.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#4 2011-12-20 13:33:09

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: My scrolling project doesnt work for some reason :(

It might help if you upload your project so I can see exactly what the problem is.  wink


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#5 2011-12-24 12:50:16

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: My scrolling project doesnt work for some reason :(

Well, sin and cos are mixed up. (I'm pretty sure, any way)


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#6 2011-12-26 13:27:51

cmp8841
Scratcher
Registered: 2011-06-19
Posts: 31

Re: My scrolling project doesnt work for some reason :(

bobbybee wrote:

Well, sin and cos are mixed up. (I'm pretty sure, any way)

sin and cos aren't mixed up. I checked.

Offline

 

Board footer