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

#1 2012-07-17 02:43:10

Aux2
New Scratcher
Registered: 2012-06-23
Posts: 32

Flight horizon engine

Right know i'm working on a flight simulator. In this flight simulator, you can fly a plane by pressing the left arrow to pan (turn at an angle) left and right to pan right. To go up, you press down and to go down you press up.

What really happens is you move a 360 X 480 rectangle called 'horizon' that moves behind a dashboard up and down when you press down and up and spins left and right when you press left and right, but this looks jerky and bad.

example

when gf clicked
forever
if <key [up v] pressed>
change y by <(speed) * (2)>
end
if <key [down v] pressed>
  change y by <(((speed) * (2)) - ((speed) * (2))) - ((speed) * (2))>
end
if <key [left v] pressed>
  turn left <(speed) * 2> degrees
end
if <key [right v] pressed>
  turn right <(speed) * 2> degrees
end
end

I was wondering if any of you could come up with a script to better simulate this with out using pen, because it makes it slower than it needs to be.

Offline

 

#2 2012-07-17 09:20:00

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

Re: Flight horizon engine

Aux2 wrote:

Right know i'm working on a flight simulator. In this flight simulator, you can fly a plane by pressing the left arrow to pan (turn at an angle) left and right to pan right. To go up, you press down and to go down you press up.

What really happens is you move a 360 X 480 rectangle called 'horizon' that moves behind a dashboard up and down when you press down and up and spins left and right when you press left and right, but this looks jerky and bad.

example

when gf clicked
forever
if <key [up v] pressed?>
change y by <(speed) * (2)>
end
if <key [down v] pressed?>
  change y by <(speed) * (-2)>
end
if <key [left v] pressed?>
  turn left <(speed) * (2)> degrees
end
if <key [right v] pressed?>
  turn right <(speed) * (2)> degrees
end
end

I was wondering if any of you could come up with a script to better simulate this with out using pen, because it makes it slower than it needs to be.

First of all, fixed your script.  Second of all, I think the problem is that you have the largest rectangle possible, but it can't reach across the whole screen correctly...to correct for this, try setting the size to the max it can be (pull a "set size" block into the scripting area, switch the block tab to something else.  Set the size to something ridiculous that you know won't work and double click it.  Then, go back to the looks block tab and look at the number now in the "set size" block.  This is the max size.

Last edited by AtomicBawm3 (2012-07-17 09:20:27)


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

Offline

 

#3 2012-07-17 16:42:21

Aux2
New Scratcher
Registered: 2012-06-23
Posts: 32

Re: Flight horizon engine

AtomicBawm3 wrote:

Aux2 wrote:

Right know i'm working on a flight simulator. In this flight simulator, you can fly a plane by pressing the left arrow to pan (turn at an angle) left and right to pan right. To go up, you press down and to go down you press up.

What really happens is you move a 360 X 480 rectangle called 'horizon' that moves behind a dashboard up and down when you press down and up and spins left and right when you press left and right, but this looks jerky and bad.

example

when gf clicked
forever
if <key [up v] pressed?>
change y by <(speed) * (2)>
end
if <key [down v] pressed?>
  change y by <(speed) * (-2)>
end
if <key [left v] pressed?>
  turn left <(speed) * (2)> degrees
end
if <key [right v] pressed?>
  turn right <(speed) * (2)> degrees
end
end

I was wondering if any of you could come up with a script to better simulate this with out using pen, because it makes it slower than it needs to be.

First of all, fixed your script.  Second of all, I think the problem is that you have the largest rectangle possible, but it can't reach across the whole screen correctly...to correct for this, try setting the size to the max it can be (pull a "set size" block into the scripting area, switch the block tab to something else.  Set the size to something ridiculous that you know won't work and double click it.  Then, go back to the looks block tab and look at the number now in the "set size" block.  This is the max size.

Thanks for the script thing but I'm not new to this. The script i put there was just an example of the algorithm I'm using to calculate the horizon.

What I was wondering was if there was a way to set the direction of the horizon when people pan to simulate a ATF competition plane.

Offline

 

#4 2012-07-18 20:27:31

Aux2
New Scratcher
Registered: 2012-06-23
Posts: 32

Re: Flight horizon engine

cough

Offline

 

Board footer