Log In  

BBS > Superblog
Posts: All | Following    GIFs: All | Postcarts    Off-site: Accounts

Overview

So the other day I delved deep into trig to pull out the bare minimum of what makes things move in circles.
The problem I've had in the past is that I often looked at games or demos that incorporated a lot more things, so I often would make incorrect assumptions about how to implement these types of things. My hope with this tutorial is to just show you the absolute bare minimum of what you need to get a sprite moving in a counter-clockwise circle, and explain everything line by line as best I can.

Here is what we are making:

To make something move in a circle, we have to use trigonometry. This tutorial is going to explain the trig functions we'll be using so that you can hopefully use them on your own without copy and pasting.

Prerequisites

To get the most out of this tutorial, you just need pico8 installed.

The gist

A sprite moving in a counterclockwise circle

radius = 30
originx = 64
originy = 64
angle = 0

while(true) do
 angle += 5
 if (angle > 360) angle = 0
 cls()
 x=originx + radius * cos(angle/360)
 y=originy + radius * sin(angle/360)
 spr(0, x, y)
 flip()
end

Rendering with pico8

[b]NOTE: Skip this section if you want to get right to the trig! Just go to "Show me the trig!"

[ Continue Reading.. ]

25
4 comments


Cart #38976 | 2017-04-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

1
0 comments


Cart #38971 | 2017-04-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Greetings! This is my first finished Pico-8 game and also my first post to this bbs.

Control the snake with arrows and try not to crash. On collecting an apple the snake grows in length but the speed remains constant. Can you fill the screen with the snake?

2
2 comments



A Customizable terrain generator under 512 characters

4
0 comments


Cart #38957 | 2017-04-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Try it out with an external viewer using chrome: http://dandoes.tech/nodeui/

3
1 comment


Your mission is to penetrate the enemies secret lair buried fathoms deep inside an active volcano and retrieve the stolen plans. Collect USB drives of enemy secrets for bonus points on each level.

Your agent is armed with only his glide suit and his wits in this hardcore platformer.

Arrow Keys or D-PAD to move.
Z or B button to Jump - press again to glide slowly.
While gliding, press X/A button or press Up to boost briefly upwards.

Get to the bottom of each level to get to the next.

Good luck! Feedback welcome.

A game save and resume/continue feature has been added. It now saves after every death and every level you pass, so it allows you to resume from right where you left off.

. .

Cart #39603 | 2017-04-13 | Code ▽ | Embed ▽ | No License
22

[ Continue Reading.. ]

22
6 comments


Here's a boilerplate I plan on using for prototyping different games.

It consists of a splash screen which transitions to the title screen, upon which the user is encouraged to press the play button. Once the button is pressed, the screen transitions to the "gameplay" state, which is nothing but a text greeting asking the user to press a button, which then results in transitioning to the gameover screen, and finally a press of the button returns the user back to the title screen.

This is a simple implementation of a Finite State Machine

Splash -> Title -> Game -> GameOver -> ...Title

Details

Demo

Cart #38951 | 2017-04-01 | Code ▽ | Embed ▽ | No License
3

[ Continue Reading.. ]

3
0 comments


Cart #38937 | 2017-03-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

This is my third entry into #1GAM.
The theme was "Write".

Sadly, I haven't quite gotten the hang of starting "early" yet.
So this, again, was cobbled together in the last few hours of the month, just to meet the deadline.

I mean, there are still 9 more months left in this year, so I might still get a chance to make an actual game in the future.
It's actually quite fitting, that most people will only get to play this starting on April Fools' Day.

0 comments


Cart #39094 | 2017-04-05 | Embed ▽ | No License

1 comment


Hi,

I'm working on the topics for picoscope 2017 (in april). I love to code, so I will speak about about tables, object oriented programming, using functions in variables, converting arguments to an array (and an array to arguments), events...
You will find samples in these cartridges.

The last event we were involded, was a great success (Roc'n Stick in Niort, France).
Pictures of the PICO-8 workshop, march 25th

I hope I will see you in the next coming weeks ;-)



Events...


[ Continue Reading.. ]

2
0 comments


This is a tiny event system, sometimes called a "message bus"; or "bus" for short, and carries a similar API to the likes of the NodeJS Event Emitter - stripped down to the bare essentials: on, off, and emit

Usage:

--create a new emitter with the pubsub() function
emitter = pubsub()

--listen to an event
emitter.on("foo",  function (e) print('foo'..e) end )

--fire an event
emitter.emit('foo', { a='b' })

--working with handler references:
function onFoo() end
emitter.on('foo', onFoo)   // listen
emitter.off('foo', onFoo)  // unlisten

DEMO

Cart #38909 | 2017-03-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
13

[ Continue Reading.. ]

13
2 comments



7
7 comments


Hi, sorry if this is a stupid question because I'm not really a web developer but I've hosted my game on my own site and it doesn't behave the same as the same game hosted here. Desktop is fine but on mobile, the on-screen touch controls are missing and I have to pinch to zoom to get the game to fill the window while on here it fits neatly even without using full-screen mode.
Can someone point me in the right direction? I'd like my Pico8 games pages to be mobile-aware.

I don't know if this is something I need to change with the export or what. I'm game to learn "proper" web development....I know some basic HTML and that's it but I'm up for getting my hands dirty if someone can point me in the right direction.

Also as an aside, I couldn't figure out how to post here without switching mobile Chrome to the desktop version. You can't seem to post otherwise.

7 comments


Cart #38879 | 2017-03-30 | Code ▽ | Embed ▽ | No License

Game of life testing...

0 comments


Hello there,

I am playing the music from a function called intro.
This function is run in the update loop.
When the game state is intro then intro is showed and this is the moment I'd like to hear some music.

Problem is that the intro function is called every time the update loop restarts and therefore the music restarts everytime producing a choppy noise.

How can I solve this issue?

My code is available here:
https://github.com/ltpitt/pico-8-pong/blob/master/pico-8-pong.p8

Thanks for your time and help :)

6 comments


My apologies if this was answered before, search didn't find me much...

Making maps in the IDE is frustrating, especially when they're big, full-width kind of things.

Is there anyway to import a tile map?

Like building it in a text editor and then pasting it in or something. Just the constant zooming/dragging is a mega pain.

2 comments


The only thing i have missing is some screen keys on mobile, i see that the pico page does it when you want load the carts... is this functionality available for us??
Thanks for the thoughts.

2 comments


Hi all,

(I am very aware that this is almost certainly a very stupid question, but if you don't ask...)

Does anyone know if it is possible to take some string content and convert it to functional/executable code in PICO-8/Lua?

[BACKGROUND]
I have LOTS of objects (tables) that all have their own, unique functionality. So unfortunately, there's little potential for sharing data/functions.
For example, many objects like this:

object_1 = {
    name = "my object #1"
    x = 8,
    y = 4,
    states = {145, 146, 147},
    action = function()
        -- code specific to this object here...
    end
}

But as I don't need all these objects to exist at the same time (and could REALLY do with saving some tokens!), I'd like to somehow store these objects + functionality, e.g. within strings.
Then at a later time, restore these back into true objects/tables again.
Something like...

local my_stored_func = "function()  -- code specific to this object here...  end"
local my_real_func = restore_function(my_stored_func)
-- now execute the code
my_real_func()

[ Continue Reading.. ]

1
5 comments


On the web player, if a cart plays any sound in the very beginning, right as it starts, that sound seems to always get cut off.

e.g.: https://www.lexaloffle.com/bbs/?pid=11255&tid=2020

The same cart when played from the native player does not get its sound cut off at the beginning.

(I don't remember if it was always like this or if this was introduced at some point. I noticed it a while back when I posted this music visualizer; I had to add a delay at the start, as a work-around to avoid an unpleasant cutting off of the first note.)

I don't know anything about web audio so feel free to ignore this next part, but it seems like since there is already a boot screen intro before a cart starts, if there's some sort of audio buffer initialization that could be done there before the cart starts producing audio, that would be a perfect way to seamlessly fix this issue.

EDIT: I should add that I use Chrome on Linux and I have no idea if it happens on other OS/browser combos

1
1 comment




If you don't know who Dainumo is, you should really check out his music over on his Soundcloud. This is a small cover of his song 2100 A.D. which has a very funky tune. I recommend listening to the original too. The cover itself isn't finished, but I would like to know if you would want me to finish it before going back to this project. Let me know what you think of this cover in the comment thread. Thanks for listening. :D

Code for Piano Roll is from Kittenm4ster.

2
0 comments




Top    Load More Posts ->