here is area 1(core)
Code: Select all
local core = {}
Gamestate = require "hump.gamestate"
local outercore = require"states.outercore"
function core:enter()
--blablabla
end
function core:update(dt)
input:update()
x = x + speed * input:get 'right'
x = x - speed * input:get 'left'
y = y + speed * input:get 'down'
y = y - speed * input:get'up'
if playerHC:collidesWith(wall[6]) then
Gamestate.switch(outercore)
end
end
function core:draw()
--blablabla
end
return core
and here is area 2 (outercore)
Code: Select all
local outercore = {}
Gamestate = require "hump.gamestate"
local core = require"states.outercore"
function outercore:enter()
--blablabla
end
function outercore:update(dt)
input:update()
x = x + speed * input:get 'right'
x = x - speed * input:get 'left'
y = y + speed * input:get 'down'
y = y - speed * input:get'up'
if playerHC:collidesWith(wall[6]) then
Gamestate.switch(core)
end
end
function outercore:draw()
--blablabla
end
return outercore
i have also tried(in area 2):
Code: Select all
if playerHC:collidesWith(wall[6]) then
return Gamestate.switch(core, outercore)
end
This is destroying meeeeeee