Revision as of 23:27, 12 March 2021 by ThePlaneGuy45 (talk | contribs) (←Created page with "== Overview == === What is pen scrolling?=== You have probably heard of scrolling engines, but what is a pen scrolling engine? A pen scrolling engine is what it sounds like...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

What is pen scrolling?

You have probably heard of scrolling engines, but what is a pen scrolling engine? A pen scrolling engine is what it sounds like, a scrolling engine that uses the pen extension.

Setup

You will need these variables

(Scroll X)
(Scroll Y)
(X Vel)
(Y Vel)

Scripts

To start off, we need to create our main script.

when green flag clicked
set size to ([1]/[0])
set [Scroll X v] to [0]
set [Scroll Y v] to [0]
set [X Vel v] to [0]
set [X Vel v] to [0]
forever
erase all // Reset the stage
draw stage :: custom // This will be explained later
draw player :: custom // This will be explained later
controls :: custom // This will be explained later
end

Now we need to do our control script.

define controls
change [X Vel v] by (<key [right arrow v] pressed> + <key [right arrow v] pressed>)
change [Y Vel v] by (<key [up arrow v] pressed> + <key [down arrow v] pressed>)
set [X Vel v] to ((X Vel) * [0.9])
set [Y Vel v] to ((Y Vel) * [0.9])
change [Scroll X v] by (X Vel)
change [Scroll Y v] by (Y Vel)

Now the important part, the stage.

define draw stage // make sure this is "Run Without Screen Refresh"
set pen size to [5]
set pen color to [#32a852]
go to x: [50] y: [50] with scroll :: custom
pen down
go to x: [50] y: [-50] with scroll :: custom
go to x: [-50] y: [-50] with scroll :: custom
go to x: [-50] y: [50] with scroll :: custom
go to x: [50] y: [50] with scroll :: custom
pen up

define go to x: (x) y: (y) with scroll
go to x: ((x :: custom) - (Scroll X)) y: (( y :: custom) - (Scroll Y)

Now to draw the player

define draw player // make sure this is "Run Without Screen Refresh"
go to x: [0] y: [0]
set pen size to [40]
set pen color to [#0400ff]
pen down
pen up

Now you have a pen scrolling engine!

Cookies help us deliver our services. By using our services, you agree to our use of cookies.