pleas help
function setup()
img = sprite(yourimage,400,400)
pos = vec2(400,400)
end
function draw()
pos = pos + vec2(Gravity.x,Gravity.y)
img.x = pos.x
img.y = pos.y
img:draw()
end
I think that will work im not sure I havent tried it.
Here’s an example.
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT)
function setup()
x=WIDTH/2
y=HEIGHT/2
end
function draw()
background(40,40,50)
x=x+Gravity.x*10
y=y+Gravity.y*10
sprite("Planet Cute:Character Pink Girl",x,y)
end
Use Gravity
I’m still working on this, but it includes Gravity, so try use this example:
-- Rockets
-- Use this function to perform your initial setup
function setup()
default = 500
rangemax = 700
rangemin = 0
-- Settings
x = -1
speed = 20
-- Double check for position of x
if x >= rangemin then
print("In range")
elseif x < rangemin then
print("Not in range")
x = default
end
-- Parameters
parameter.watch("x")
parameter.number("speed",20,40)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(0,0,0)
-- Do your drawing here
sprite("Cargo Bot:Background Fade",374,374)
sprite("Space Art:Red Ship",x,100)
x = x + Gravity.x * speed
end