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

#1 2012-08-28 12:54:39

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Bicycle Engine

What is a useful script to make a bicyle that has +-3 sprites : a bike frame and 2 wheels.

The wheel turn up ,down ,forward and backward and the bike goes to both wheels


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#2 2012-08-29 00:44:48

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Bicycle Engine

bump


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#3 2012-08-29 13:18:06

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

Re: Bicycle Engine

I would have the bike frame move and the wheels follow the frame.  Here's a useful script:

when gf clicked
forever
go to [bicycle frame v]


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

Offline

 

#4 2012-08-29 17:37:10

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Bicycle Engine

Thanx and i think i have a script for it but the back wheel goes to the x of the bike frame -20 and the frame goes to the x of the front wheel -20 now all that i need is a scrolling script for the front wheel accelleration and turning on slopes and the same with the back wheel and the frame.


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#5 2012-08-29 19:11:27

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Bicycle Engine

If you want a good script for the front wheel turning and so the screen moves:
-Find the radius of your wheel in pixels (distance from the center to the edge of the wheel).  I'm going to call it x.
-Find 2x*pi or x*6.283.
-Divide by 360.
This is the number of pixels the bike should move for every degree that the front wheel turns.  You can either make that a constant value, or have it be changed by another variable.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#6 2012-08-29 23:01:22

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

Re: Bicycle Engine

when gf clicked
forever
go to x:(([x position v] of [frame v])-(20)) y:([y position v] of [frame v])
Edit: a way to reword AtomicBawm3's post:

The circumference of the circle is 2πr or 6.28 x radius

The length of one degree is the circumference divided by 360 ((6.28*radius)/360)

rotation = (change in x*360)/(6.28*radius)

Feel free to double check my math everyone, I'd appreciate confirmation.  smile

Last edited by MoreGamesNow (2012-08-29 23:06:45)


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

Offline

 

#7 2012-08-30 01:05:39

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Bicycle Engine

I assume you're not worrying about implementing accurate bicycle physics (like in Free Rider or Canvas Rider)?

Offline

 

Board footer