Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("RedGame")
- mod = peripheral.find("modem")
- mod.open(1)
- RedGame.init()
- local w, h = term.getSize()
- local receive = function(ev)
- packet = ev[5]
- term.setCursorPos(1,1)
- write(packet.x.."<->"..packet.y)
- end
- local mytest = function()
- paintutils.drawBox(1,h-5,w,h,colors.gray)
- paintutils.drawFilledBox(2,h-4,w-1,h-1,colors.blue)
- term.setCursorPos(6,h-4)
- term.setTextColor(colors.white)
- textutils.slowPrint("Hello, i am the VERY FIRST npc in redgame!",55)
- term.setCursorPos(5,h-3)
- textutils.slowPrint("Textbox methods have not been setup as of yet.",55)
- os.pullEvent("key")
- RedGame.draw()
- end
- inlevel = 'main_room'
- local level = RedGame.getResource("mylevel_image")
- local block = RedGame.getResource("mylevel_blocks")
- local level2 = RedGame.getResource("mylevel2")
- RedGame.setMap("MAP001",level,block)
- p = RedGame.createPlayer(1,20,8)
- p:addEvent("modem_message",receive)
- RedGame.editBlock(1,"purple","blue","$",true)
- p:put()
- p2 = RedGame.createPlayer(3,20,7)
- p2:put()
- RedGame.draw()
- p:addInteraction("MAP001",20,7,mytest)
- while true do
- packet = {
- x=p.x,
- y=p.y,
- }
- if(p:getBlockUnder() == 11 and inlevel == 'main_room')then
- RedGame.setMap("MAP001",level2,block)
- p:setPos(19,13)
- inlevel = 'door_1'
- RedGame.draw()
- end
- if(p:getBlockUnder() == 11 and inlevel == 'door_1')then
- RedGame.setMap("MAP002",level,block)
- p:setPos(17,9)
- RedGame.draw()
- inlevel = 'main_room'
- end
- p:update()
- mod.transmit(1,1,packet)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement