Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles

bearknuckles

29
Posts
13
Topics
1
Followers
A member registered Sep 18, 2017

Recent community posts

well... I'm a bit confused on what you need. if you could post a screenshot of your spritesheet so I could see what you're doing I'd be able to help you better but here goes.

The easiest way to animate sprites is to use a game time variable (usually named "t" in tic 80) like this:

Local t=0 --initialize it at 0

function Tic()

 --game code here

t=t+1 --add to time every frame

end

Now you can call  spr () like this:

spr(  sprite_index+t%60//30, x,y)

This will switch between a Sprite cell and the cell directly next to it. If you want to cycle over four sprites for example it'll look like this:

spr( sprite_index+t%120//30, x,y)

This is the method that I use, and like I said if you could elaborate on your question and maybe post some screenshots I could help you better.

No wait...  press "A" for silence (or a rest) and press "delete" key to erase a note

oh I've done this before.

I think you have to press "A" on your keyboard.

I use an Xbox 360 controller for all my be pc gaming. it seems to work perfectly for TIC-80 as well. They're USB so it's plug and play.

Tic-80 doesn't assign scripts directly to sprites. Instead you'll have to make a code "object" like this:

player = {x=10, y=5,sprite=255}

This is just a table to hold the players position and the correct sprite. (This assumes the player sprite is drawn in the 255th slot of the sprite sheet)

Then you can call the spr() function like this.

spr(player.sprite, player.x, player.y)

This draws the 255th sprite at the player's position.

There's a bit more abstraction in tic-80 with how graphics and code work together. It helps to think of all the code as being the game, then drawing the graphics to show the player what's going on, as opposed to applying code to each object.

Check out the tutorials on the wiki for more help

https://github.com/nesbox/TIC-80/wiki/tutorials

(1 edit)

okay... I've used Love 2d. They use callbacks a lot so I get how that works. 

That is the demo is looked at but I'm not familiar with moonscript,  so I'm still a bit confused on how to actually feed the remap function data and such. Maybe something like this?

map(0,0,30,17,0,0,-1,remap(tile) 

   If tile == 1 and btn(4) then tile=2)

If map is drawing a 1 tile and the player presses z then change it to a 2 tile.

Is this right?

I've been working on a game, and wanted a way to hide rooms you haven't visited. After some messing around I came across the remap ability of the the map() function. It sounds like it could do this, but I can't figure out how it works. I've checked out the demo cart on it but it's in moonscript. I read the wiki page but it's pretty vague about the remap part. Will this do what I want, and does anyone know how to use this feature with Lua?

I realize this an older question but seeing as you haven't got a reply, maybe you still need help?

Check out the tutorials page. I have a collision tutorial on there plus a handful of other useful stuff.

https://github.com/nesbox/TIC-80/wiki/tutorials

Good luck!

TIC-80 community · Created a new topic Using memory Banks?

okay... Been away for a while and now everyone's talking about memory Banks.

From what I gather it sounds like you can have the equivalent of 8 carts that can be loaded between at runtime. 

I think this is only in the pro version.

Could this be used to load different graphics/behavior code for the different levels of a huge game?

And how do you actually use this feature??

(2 edits)

Save your progress,

load a new cart

Copy the palette 

(in the sprite editor hit the 'sliders' button on the right of the palette. A clipboard appears on the left side. Hit that to copy the current palette as a hexadecimal string in the clipboard)

Load your cart again.

Paste it into your cart

(Again push the sliders button, but this time hit the paste button)

Does that work for you?

Thanks mlepage... I had been using Lua for about a week when I wrote this... And have since learned a lot about the language.

But I always appreciate anyone taking time to teach me stuff. πŸ‘

Hey duo, I'm glad they're helping!

There are actually peek and poke commands in TIC-80...I'm messing around with them right now and hoping to post a tutorial on it soon. btw...love your avatar...I too didn't have a bandit mask and had to modify a tube sock :D  

And there's more TUTORIALS out!

Using mset() and mget() Functions

Making Realtime Minimaps

Random Point Level Generator

GBF Pathfinding

again, if you check the tutorial page frequently you may have already seen these :)

A* is still coming...just hit a few snags :)

I've been playing with the idea of making a handheld TIC-80 console (similar to a Gameboy Original) with a raspberry pi, and pre-install all of the best games from the website, but it would have to go straight to surf mode because there'd be no keyboard. 

Any ideas how something like this could be done?

(2 edits)

New tutorials!

Sprites and maps

Drunk Walk Level Generator

Mouse/Touch event handling

BFS Pathfinding

These are just the tutorials out since my last update... If you visit the tutorial page frequently you may have already seen them :D


Stay tuned for :

A* Pathfinding 

Inventories

Using mset() and mget()

Dynamic Minimap

And more!!

Okay... I'm making headway on pathfinding. I'll try to post the five most common algorithms in separate tutorials as they get gradually more difficult... But may be a while still before I have a stable version to show :)

As for inventories, that will be easy. Everything involved is more or less stuff I've already covered, just used differently. That tut should be up as soon as I finish the demo cart... Give it a couple days

Hey thanks! I'm glad it helps :D

I'd never heard of A* before, but I've been looking around and I think I can help you there. I'll post a tutorial as soon as I crack it.

What kind of menus/inventories are you wanting? I do have a tutorial on that in the works, so I'd like it to be applicable to what your looking for.

Okay...I gotcha. thanks

Okay, I found that it copies the file I pick to the current tic-80 directory... But why? 

If you type HELP in the console, you get a list of commands...

just now I noticed the "ADD" command. It says "to add files".

What does that mean? Can I add external text or image files? Or maybe point to other .tic carts in the same directory? What's it used for?

oh alright... I'm look forward to it

I was on the TIC-80 website and noticed this on the homepage:

"... Also the game can be packed into a player that works on all popular platforms..."

That's sounds super sweet, how does it work?

Or you could use the Pal function to change the  Color of a single palette slot.

https://github.com/nesbox/TIC-80/wiki/code-examples-and-snippets#pal-function

TIC-80 community · Created a new topic New Tutorials Out!!

Okay, I've knuckled down and belted out a few beginner tutorials!

https://github.com/nesbox/TIC-80/wiki/Tutorials

Just for anybody new to TIC-80 that needs some help! :)


If you've got some requests, you can post them here and I'll see what I can do.

And I'll keep updating this thread when I have enough new tutorials to warrant it.

I've solved it. On android the keyboard doesn't want to pull up when the game is running. Just install the "Hackers Keyboard" from the play store, it's free. Go into the settings and turn on "persistent notification". run the game, pull down the notifications bar and pull up the keyboard manually. Hackers keyboard has function keys, so hit F7 and your good to go!

Oh...got it! I never thought of that. thanks!

I've been messing around with the color palette and had a great idea... Why not recreate the look of the Gameboy with it's greenish monochrome?!


I changed all of the colors from the default palette to a gradient of green. I know the original only had four colors, but 16 shades is a lot more useful. Here's the concatenated hex values:


002c000f380f1c481c204c202855283062303869384879485985446d91597d9d698bac759dc281aad689ceeeaeffffff


If you just copy all that, then head to the sprite editor, hit the sliders button to the right of the palette, and push the paste button now on the left side...


You end up with a nice little mock up of the Gameboy palette!! Ah sweet nostalgia...


I have filled out AUTHOR, TITLE, etc... at the top of the code. I tried pressing F7 in the editor and at the website when it complains but nothing...I can switch between code editor, sprite editor etc with the hotkeys so I know they work... Where and when do I press F7?

TIC-80 community · Created a new topic Adding Metadata?

I'm trying to upload some demos to go with some tutorials I wrote, but when I try posting them it tells me to hit "f9" I think it was... And add metadata. I'm not exactly sure where or when to hit f9. Anybody care to give a quick walk-through on adding metadata? I'm on Android if it makes a difference.

ooh... That's even cooler. I was wanting to make some animated gifs to include in some tutorials I was writing, just want sure how to go about that πŸ‘

I was looking through the config file for TIC-80 (I'm a customization nut 😊) and I noticed a line near the very bottom...

GIF_LENGTH=20 -- in seconds

Is it just me or does this sound like support for animated gif sprite sheets?! Is this possibly what it's for?

Found something HUUUGE!

I was browsing the GitHub wiki page and found something in the code snippets!

https://github.com/nesbox/TIC-80/wiki/code-examples-and-snippets#pal-function

It's a little function that does exactly what I was talking about! It takes the color index, and the RGB values for the desired color, and modifies the palette. I imported it into one of my scripts and had it running in seconds!! Just leaving this link for anyone interested.

(1 edit)

Oh of course!! How dumb of me😁 I was trying to call the attributes of z without using z.attrib1!!

I rewrote my original script to include it and everything works perfectly!!

(1 edit)

Okay... That code works...

I see that you indexed the attributes by number. That must be my problem... I'll do some more testing.

Thanks a million!

Btw... What is strange about the code? The way it's written or the way it works? I'm just curious if I'm doing something wrong πŸ˜€

(1 edit)

okay...Here's a simplified version of my generation code to test the application. it has all the problems of the original code (I've tested it extensively) If you run it in TIC-80, you'll see that the problem is in the get_obj() function. The attributes end up nil.

The get_attrib() function seems to retrieve the data correctly, but it may have a problem returning the value.

Or maybe there's a problem calling a function with a return value from within another function.

 I can't seem to figure out why there's a problem assigning my attributes. anybody got any ideas?


--script: lua

attribs={"spam","toast","blah"}
objs={}

--get a random attribute
function get_attrib()
 trace("getting attribute...",14)
 local random=math.random(1,3)
local attrib=attribs[random]
trace("gotten attribute is...")
trace(attrib,9)
trace("")
return attrib
end

--get an object with three attributes
function get_obj()
 trace("building object...",8)
 local z={
attrib1=get_attrib(),
attrib2=get_attrib(),
attrib3=get_attrib()}

  trace("objects returned attributes...")
trace(attrib1,6)
trace(attrib2,6)
  trace(attrib3,6)
trace("")

  --log the object in the "objs" table
  trace("logging object",5)
  trace("")
table.insert(objs,#objs+1,z)  

end

function TIC()
 
--test get_attrib() return directly
trace("getting a test attribute",8)
temp=get_attrib()
trace("test attribute...")
trace(temp,2)
trace("")

--log an object 
 get_obj()
--iterate through objects and test for
--certain attributes
trace("started object testing",8)
for i,v in pairs(objs) do
trace("object attributes are")
trace(attrib1,6)
trace(attrib2,6)
trace(attrib3,6)
trace("")
end
trace("end of process",6)
 exit()
end

(1 edit)

it worked for you? 

great, thanks. I'll just look for problems in my hardware. maybe if i reinstall TIC-80 it'll resolve the issue. Or there may be a typo somewhere upstream in my code. i'm just glad it's not some elusive programming syntax problem.

I've been working on procedural map generation in TIC-80 (ambitious I know...) And I've hit a problem that's got me stumped.


I need to write a function that builds a table of attributes for an object, that I can call later...

Something like:


Function build_obj()

 Local z={

 attribute1=blah,

attribute2=blah,

attribute3=spam}

 return z

end


From there I can create objects like so:


obj1=build_obj()

obj2=build_obj()

etc...


The problem is when I try referring to my objects:


If obj1.attribute==blah then

 do awesome stuffs

end


I always get an error saying

"Attempting to index a nil value"


I understand what this means... Somewhere in the deep recesses of my code, my table of attributes is getting lost. And so obj1 is being assigned no value.


I've been googling this problem... It could happen if I typed


obj1=build_obj 


By leaving off the parentheses I'm assigning the entire function to the variable object. I've double checked and this isn't my problem.


Anyone know what I'm doing wrong?? 

Wow... This looks like exactly what I'm looking for! I'm going to have to read through the code seven or twelve times to fully understand it, but it's already answered some questions I had. 


The cart does run pretty slow, but maybe if you're not rewriting the RAM so much it don't take such s performance hit?

Thanks for the reply!

(1 edit)

Did a little bit of research... Looks like you could use the"poke" command to write data directly to the RAM address : 03FC0. Which is where the palette data is.

I don't really understand RAM that well, but i would guess it contains the the RBG values in order from 0-15. So maybe you could save the colors as a table of numbers, update it when necessary, and write the whole table to RAM periodically. I'll have to mess around with it some but the code might look something like this:

Color ={
 1st=RGB#forBlack,
 2nd=RGB#forRed,
 3rd=RGB#forBlue,
 etc...............
 --all the way to 16
 }
--if the players skin color is in slot 5 for example...
if p.poisoned==true then
 Color.5th=RGB#forGreen
end
update_colors() --user defined function to write the "Color" table to RAM

hey, crazy idea I had.

Anybody got any ideas for how to change the color palette in game?

Like logging the desired RGB values in a table, then changing a single palette slot when certain things happens. Like making your character turn gradually greener the longer they've been poisoned.


The uses seem pretty huge. What do you guys think?

I've looked around and found about 3 tutorials for tic-80. And about the only thing that could make tic-80 better is more tutorials. So where would be the best place to find/post tutorials? I'm hoping to write some stuff for beginner.