Results 1 to 2 of 2

Thread: Just a little help with LUA >_<

                  
   
  1. #1

    Red face Just a little help with LUA >_<

    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

  2. #2
    DCEmu Newbie
    Join Date
    Mar 2006
    Posts
    32
    Rep Power
    0

    Default

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •