Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

Thank you,

I would say that if you're starting out on the idea, getting it done in the next few days could be hard, but go for it if you want to. You can go ahead and use code from this one if you can understand it, though it's super compressed. Here's a really useful piece, though, that's slightly simplified from the version in the cart.

ˇ-=4b=btn()p+=b%4-b%2*3if(b\9*ˇ<0)x=p+2ˇ=k

That one line contains basically all the logic for the movement of both the player ship and its projectiles. I'll break it into a few parts to explain.

ˇ-=4                      This moves the single player bullet up 4 pixels every frame.  The "ˇ" symbol, which represents the bullet's y position, doesn't have to be initialized because before it's given a value, it already has a negative one. (it's the only symbol like this that doesn't count as two chars on Twitter, though, as far as I know).

b=btn()p+=b%4-b%2*3    This moves your ship's horizontal position, "p", using the left/right keys

if(b\9*ˇ<0)             This allows a bullet to be fired if the last one is off screen and you press the Z or X key (well, there's only one, so it lets it be re-fired). 

x=p+4ˇ=k               This aligns the bullet x and y positions with those of your ship (represented by p and k), putting it in firing position. Since it automatically moves up, it looks like it's being shot.

Deleted 252 days ago
(5 edits)

You're welcome. I like breaking things down and helping people understand it. I know I have to do that a lot for myself.

For vertical movement you can just extend the same concept to the values of 4 and 8, like this:

x+=b\2%2-b%2y+=b\8%2-b\4%2

It's the same pattern for every button, but you can simplify the expression for button 0. I initially used a slightly different method, with a swapped order of the floor divide and modulus operators, but that took an extra character or two.

As for waiting till next year, the tweettweet jams are roughly every 6 months, so you might still make it this year. =)

Deleted 252 days ago
(3 edits)

Honestly, those two operators are the foundation of much of the logic in my code these days. They basically allow various non-linear behaviors to arise from linear numeric inputs, so you can use them to replace a lot of cumbersome branching conditional logic.

I've only been coding on and off for a handful of years myself, and not very regularly until the last year and a half, but I enjoy the  problem solving and the freedom to approach things creatively. Guess it also helps that I'm very comfortable with math.

Deleted 252 days ago
(1 edit)

Looks good, though you could actually switch to a 60fps update function with equivalent movement speed for just 2 chars more, eg:

x=60y=60::_::cls()b=btn()

x+=b\2%2*2-b%2*2y+=b\8*6-b\4*2

circ(x,y)flip()goto _

vs.

x=60y=60function _update60()cls()b=btn()

x+=b\2%2-b%2y+=b\8%2-b\4%2

circ(x,y)end

I can relate to feeling a bit clunky sometimes, but there's one nice benefit to having a living brain rather than a hunk of silicon, you can actually rewire it a bit over time. ;)

Deleted 252 days ago