Posted 27 November 2015 - 04:09 AM
Redgame
What is redgame?
Redgame is a RPG game API
it allows you to create single or even multiplayer RPG games
easier than before. with over 50 differant functions to shorten and
simplify your code!
Creating maps
Redgame also comes with a map editor (seperate program)
that allows you to easily create maps!
you can even add your own custom blocks to the map!
when your done press control to access the menu and
save your blockmap and map files then simply load them both
with -
Redgame.loadResource(map)
Redgame.loadResource(blockmap)
Controls
Map Editor -
Use the mouse scroll wheel to select blocks
and left click to place them
press right click to remove blocks
press ctrl to access menu
Default game controls -
The defualt redgame controls are
WASD to move
and space to jump (only if you have experimental physics turned on)
Redgame Functions
Spoiler
init() -- initializes Redgame required to begin
getGMAP() -- returns map containing all blocks
getPMAP() -- returns map containing AI/Players
getGBLOCKS() -- returns table of blocks loaded into map
setPMAP(x,y,id) -- sets a block in the player map to a
specific block ID
setGMAP(x,y,id) -- sets a block in the block map to a
specific block ID
openTextbox() -- used to start textbox functions
clearTextbox() -- clears the current textbox
drawTextbox(text,ln,speed) -- draws text in open textbox
at the specified ln (Line) and at the specified speed
createYesNo(YText,NText,ln) -- returns "ok" if Yes was clicked
and "no" if no was clicked drawn at specified line (ln)
addDoor(fromx,fromy,tox,toy,fromMap,toMap) -- adds a door
at the specified x and y (fromx, fromy) and on the specified map
(fromMap) to the specified x and y and to the specifed map
draw() -- redraws/draws the block and player map
closeTextbox() -- waits for key press then closes text box
closeTextboxRaw() -- closes textbox does not wait for key press
drawMapPixel(x,y) -- draws a block on a map at the
specifed x and y
(mainly used to update one block instead of entire map)
lookupBlock(id) -- returns true if block is on the map and false
if it isnt.
findBlockAt(id) -- returns x and y of first found block
with specified ID on the map. returns nil if fails
getBlockAt(x,y) -- returns block id and specifed x and y
setBlockAt(id,x,y) -- sets block at specified x and y
breakBlockAt(x,y) -- breaks block at specified x and y
editBlock(id,color,bcolor,graphic,solid) -- edits block in game
(temporarily will reset when new map is loaded)
getCurrentMap() -- returns the map we are currently on
addMap(name,levmap,blocks) -- adds map bases of loaded resources (map, block map) map is identified by, name
parameter
setSolid(id,solid) -- sets a non solid block to a solid
getResource(file) -- returns unserialized table of map or
blockmap
setMap(map) -- sets the current map to a map that was added to redgame VIA redgame.addMap()
getMap() -- returns entire block map
createPlayer(block,startX,startY) -- returns player object
--]] PLAYER OBJECT FUNCTIONS [[--
addInteraction = function(self,mydmap,x,y,func)
--]] adds a block interaction
(when player moves around x or y and presses the interact key will run the function (func) )
removeInteraction = function(self,mydmap,x,y)
--]] removes interation and map and x and y
setPhysicsTick = function(self,time)
--]] sets speed in which physics are applied (only for gravity)
addEvent = function(self,check,evfunc)
--]] doesnt have a use just yet
getBlockUnder = function(self) -- returns the non solid block
the player is standing over (useful for pickup items)
checkCollision = function(self,x,y)
--]] checks for collision at specified x and y
jump = function(self,ammount)
--]] only for gravity - jumps up an amount of blocks
moveUp=function(self,ammount)
--]] moves the player up and amount if there are no collisions
moveDown=function(self,ammount)
--]] moves the player down an amount if there are no collisions
moveLeft=function(self,ammount)
-]] moves the player left an amount
moveRight=function(self,ammount)
-]] moves the player right and amount
checkPhysics = function(self,element)
--]] checks for a physics element
checkInteract = function(self)
--]] checks if the player is in the bounds of a interaction event
put = function(self)
--]] puts the player on the map
(usually ran right after creating a player)
unput = function(self)
--]] removes player from the map
applyPhysics = function(self,element)
--]] used to turn physics elements on
setJumpHeight = function(self,h)
--]] sets the players jumpheight (only for gravity)
createPhysics = function(self,element,physic)
--]] create your own physics! by passing a table containing a
function example (func = {function() physic stuffs end})
remapPhysicsControl = function(self,name,to)
--]] remaps physics interation control to the "to" argument
remapControl = function(self,name,to)
--]] remaps a control
addControl=function(self,controltable)
--]] pass the function a control table to add your control
example -
({name = "name",event= "key",key=keys.<key>,
func=function(self) what happens when control is pressed? end};)/>/>/>/>/>/>
importControls=function(self,controltable)
--]] used to import a table of multiple control tables
setPos = function(self,x,y)
--]] sets the players position
update=function(self)
--]] updates the player (put in a while true loop)
If you have any questions post a comment and i will get back to you as soon as i can :)/>Downloads
Redgame - http://pastebin.com/jgNes9j8
Map Editor - http://pastebin.com/E3Jc2RpC
Edited on 19 February 2016 - 02:57 AM