Log In  

Cart #spleeko-1 | 2020-04-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


i am trying to make the screen follow my little dude but all it does is make him pop back at the left end of the screen i would like some help

P#75176 2020-04-22 22:28

@TigerCat104 are you using the camera function?
here is an example:

function _update()
    camera(player.x,player.y)
end

replace player.x and player.y with your x and y coordinate varible
Hope this helps!

P#75179 2020-04-22 22:53 ( Edited 2020-04-22 22:54)

If your trying to have the screen scroll when you move off the screen change a var for x and y in camera() that way it bump over a screen in the directions you want

P#75188 2020-04-23 00:25

in your code, your problem comes from line:15 :

12:  if x > 127 then
13:   mx = 16
14:   x = 0
15:  else
16:   mx = 0 
17:  end

if x>127 then mx=16 and x=0 so far it's ok
in the next fram, x=0 therefore x<127 else mx=0
to correct this, use elseif x < 0

and think about modifying the x

I propose that :


I used 123 and -4 so that the transition occurs when the character is halfway between the two maps

  if x > 123 then
   mx = mx + 16
   x = x - 127
  elseif x < -4 then
   mx = mx - 16
   x = x + 127
  end

his message has been translated from french by google, sorry if there are any weird phrases

P#75197 2020-04-23 05:47

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 23:19:38 | 0.019s | Q:23