Just something really quick thats been giving me problems. When programming in lua, how would I make a unpassable object, like a rock or something, in an RPG styled game. I want the player to stop when he touches a color,for example,
red = Color.new(255,0,0)
block = Image.createEmpty(X,Y);
block:clear(red)
Thanks![]()
I think what you're looking for is some collision detection. Here is an example of a good collision tutorial: http://forums.qj.net/showthread.php?...ight=collision
Now all you would have to do is add an "if" statement saying something like
if blockx == playerx then playerx=playerx end
That way you would have different variables for the X and Y values of the block, and the X and Y values of the player. Once they are equal, the player will remain in that same x position until blockx ~= playerx
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks