urielsalis, on 09 February 2013 - 06:13 PM, said:
GameUtils- Now with Collision Detection!
#21
Posted 10 February 2013 - 12:44 AM
#22
Posted 10 February 2013 - 05:05 AM
#23
Posted 10 February 2013 - 11:48 AM
#24
Posted 10 February 2013 - 12:30 PM
#26
Posted 12 February 2013 - 04:36 PM
- Fixed a bug with animations appearing off-centre when positions are initialized in the constructer
- Removed some debug scripts when loading sprites from file
- Allowed animations to be updated without a timer ID, this being a "forced update". Passing a nil timer ID will allow this; animating using timers should still pass through whatver ID the timer used.
- Added a "moveTo" method for sprites and animations. Access to X and Y is possible directly but this is unsafe as this refers the transformed coordinates according to the sprite's bounding box, not to relative screen space. You can still increment the X and Y values safetly enough for relative motion, but for absolute positioning on the screen it's unsafe, so moveTo is necessary. I've workshopped a few different ways of solving this issue and ironically it's the first time I've yet to come across where access restrictions feel completely necessary, but for the moment this will remain. For consistency I'd recommend using moveTo for relative motion as well.
I'm also planning on peppering this post with screenshots of games I've made using gameutils- I've done one or two little games and am working on at least two new demonstrations for how to use the API (particularly animation features and loading), and am working on at least one "tech demo" game. So here's the first, hopefully of many more to come!
#27
Posted 17 February 2013 - 08:34 PM
#28
Posted 18 February 2013 - 11:43 AM
#29
Posted 05 March 2013 - 11:10 AM
#30
Posted 07 March 2013 - 12:38 PM
Here you go
function drawBuffer(terminal,backgroundColor) if not terminal then terminal = term end backgroundColor = backgroundColor or colors.lightBlue if not backbuffer then error("Back buffer not yet initialized!") end if not terminal.setCursorPos or not terminal.setBackgroundColour or not terminal.write then error("Parameter cannot be used to initialize the backbuffer.") end if not terminal.isColour() then error("Parameter does not represent an advanced computer.") end --I used these lines alot so I put it in a function local function modWrite(x,y,color,text) local color = color or colors.black local text = text or " " terminal.setCursorPos(x,y) terminal.setBackgroundColour(color) terminal.write(text) end if backbufferOld then for y=1,math.min(#backbuffer,th) do for x=1,tw do if backbuffer[y][x] == backbufferOld[y][x] then if backbuffer[y][x] then modWrite(x,y,backbuffer[y][x]) else modWrite(x,y,backgroundColor) end else if backbuffer[y][x] then modWrite(x,y,backbuffer[y][x]) else modWrite(x,y,backgroundColor) end end end end else for y=1,math.min(#backbuffer, th) do for x=1,tw do if backbuffer[y][x] then modWrite(x,y,backbuffer[y][x]) end end end end --Performs a "deep copy" of the table so we dont get pointer problems backbufferOld = textutils.unserialize(textutils.serialize(backbuffer)) end
#31
Posted 09 March 2013 - 05:02 AM
darkroom, on 07 March 2013 - 12:38 PM, said:
Here you go
-snippy
#32
Posted 21 July 2013 - 11:43 AM
This is my code, which doesnt work
--Developed by Makerimages os.loadAPI("/apis/gameutils");--Load the animation api local topBar=gameutils.loadSprite("/graphics/TopBar.nfp",1,1);--top bar local w, h=term.getSize(); local loadBar=gameutils.loadAnimation("/graphics/LoadingBar.nfa",math.ceil(w/2-3),math.ceil(h/2));--loading bar loadBar.currentFrame=1; gameutils.initializeBuffer(); gameutils.writeToBuffer(topBar); gameutils.writeToBuffer(loadBar); gameutils.drawBuffer(); while true do loadBar.nextA(loadBar); endloadBar has 11 frames
#33
Posted 05 August 2013 - 12:26 PM
#34
Posted 09 August 2013 - 08:35 AM
#35
Posted 14 August 2013 - 04:14 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users