Log In  
Follow
Cerb043_4

Cart #a4343-0 | 2022-12-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

"Legend of the ChunChunTree" is a 2d turret-defense wave survival shooter featuring an rpg-style castbar system, tons of buttons per button, a kinetic-physics system, and the ability to simultaneously control two overloaded weapons(the bullet-hungry 'TriMG' and magical-casting 'Epica'). V1 #FreeToPlay inbrowser on #Pico8 bbs and download(click)/cart/splore.

Practice: <controls_overlay>redDots show fingerRest positions; redPoppies(blackDotWithRedDots) show keys with tap/tap2/hold states; practice waves with f,u,h,i,g,j,y (recommended).

Survival: Keep your hp>0 for 400s. Score 웃---(least dmg taken per run) is saved at end of each successful run (lower is better; post me your best[the score to beat is 웃345.5]).

[ Continue Reading.. ]

8
2 comments



I'm going to start with my general understanding and label questions [Q#] with the hope someone can fill in the blanks. Consider the discussion of 'cost' in terms of speed/cpu. I'm hoping there's a general concept I'm missing that will cleanup the flurry of questions around [Q2], regardless please bear with me:

General code is written topdown like the below where you define the function at the top and then you can simply call said function below that point to access the block inside. I don't fully understand the cost, in terms of lua itself, associated with defining 'function a()end' (the pico8 wiki has general pico8 cycle costs). My understanding though is the program won't look inside of the function 'until' I call it and so there is simply some generic predefined 'base cost'(cpu cycles) to defining a function and this cost is not affected by the number of parameters or whatever is inside the function....tldr it's always a flat cost each time the compiler/better-word runs down that part of the page and sees you want to define a function. So this usually amounts to the general idea of 'define the function once at the top of the code' and then call it as many times as u need where u need to after:

[ Continue Reading.. ]

4 comments



I have a stationary object firing bullets at foe(enemy object). The problem is the game is running at 30fps, and the bullets are travelling at a pretty fast speed, so fast that they sometimes endup on the other side of the foe, but not so fast that they passthrough foe. I'm using circular collision and the foe have a circle of radius 4 with origin placed at the center of their circular-sprite. The bullets are small with radius of 1 or 2. Everytime a bullet is colliding within the foe's circle the game takes the angle between the bullet and the foe (the bullet-foe-angle) and applies a force in that direction onto the foe. Normally this would mean any bullets fired at the foe push the foe in a 'general direction away' from the bullet's point of origin but not necessarily in the direction of the bullet's projectory(unless it's a dead-on hit). But a bullet which first appears on the other side of the foe's origin... is going to push it forwards, towards the bullet's point of origin. Also of note is that the last bullet to hit the foe before it hits 0 hp determines the direction of the foe's ragdoll/corpse effect(any small bullet bump basically gets pronounced for a second or two). Each object has a dx,dy variable tabulating all the forces applies on it that frame then added to their x,y.

[ Continue Reading.. ]

6 comments



Cart #bodoguwofo-1 | 2022-09-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3


Teatime!v2 is a top-down 2-handed-keyboard roguelite shooter featuring experimental controls, 6 weaponTypes, 3 playable characters, and quirky mechanics. Free-to-play inbrowser on itch.io and the pico8 bbs.

Goal: Keep your cupHp and playerHp above 0 for 300s while preventing no-more than 10 leaf from entering your cup. When the timer hits 0, you are given 10s, from times [0,-10], to drink the tea before it spoils.

[LongPlay: Fewer leaf in your Cup will mean a higher score and potential bonuses]

Left_Hand:
a|d: angle of fire
s: fire; (tap)shotgun/sniper, (hold1)bomb/kinesis, (hold2)mg/poison
f: (tap)grab-nearby/drop cup; (hold)drink from heldCup
e: drop fakeCup

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=117549#p)
3
0 comments



https://pico-8.fandom.com/wiki/P8SCII_Control_Codes#Audio_commands
Because there doesn't seem to be a method to specify the audio channels with "\a" I am trying to transfer my sound effects to the sfx editor.

I don't understand how to do this though. Let's take this example:
?"\as16x3a0"
s16...spd set to 16
no volume is specified so the fourth column is 5 by default
x3...final 5th column set to 3 for all notes
a0...note a(press n cause idk how to type it in manually) and octave 0

In the sfx editor that gets me, with spd=16, this:
a 0053

?"\as16x3a0" does not sound like that at all....so idk what I'm missing here. I need to figureout how to do it for notes like ?"\as9x3a-2i0dd1" which includes "-" being a sharp and idk how to input a sharp at all, # seems to be the keys above n's row.

Would appreciate an explanation on what I am missing here, and if there is a way to transfer it without manually going through it like this.

6 comments



I'm trying to setup a new menuitem (i.e. on enter menu) for muting the music. (1) the code below will mute properly but won't display the updated value of the switch i.e. "Music:on" will always display. Putting menuitem() in _draw will fix this...allowing for "Music:off" to display, but not when the callback is true (menu doesnt auto-close).

(2), I'm concerned if I should be calling menuitem() in _draw or not to begin with (if its better cost-wise elsewhere). I am not overly familiar with cartdata and dset/dget but was trying to store a value there and check that in draw instead....not sure if that's the right way, but its not working atm anyways.

How should I ideally set this up such that music:on/off can be seen and toggled within the menu, with the callback returning true (menu not exiting on click)?

cartdata("test")
switch=true --true is music_on
music(0,1000,1) 

function _draw() cls(1)
	if dget(1)==0 then switch=true else switch=false end --not working, was trying to update display for menu

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=114087#p)
3 comments



I have a foe taking damage from multiple bullet types on the same frame. I'm able to inflict 'impact' movement to the foe via the bullets update function (i.e. the foe jiggles when struck and still alive). The problem though is the death movement. I want to send the foe flying a certain amount depending on what kills them. Instead of doing calculations inside the bullet update like I had for the jiggles... I had been sending an id of the last struck bullet type to the foe's update, where it could then do the operations. This works fine for single shot deaths. However this doesn't look great when they get hit by like 10 things at once on a frame and they do the kinetic animation for the wimpiest bullet they r hit with. So I need a system of identifying basically the bullets (the type and number of each type) from the last 10 frames that have hit...and define that into some kind of kinetic energy multiplier to determine how far the body flies.
Question is how do I go about this, and is there a better method?

[ Continue Reading.. ]

7 comments



Okay so I'm looking to make an orb animation like this: https://jsfiddle.net/aycn3fzd/
I'm not really sure if the solution is within that post or not, I'm having a hard time converting it.
Regardless, I'll explain what I have and the issue I'm having with completing this task.
Here's what I have atm:

I want an orb that will fill/unfill based on the percent of something left. So the generic red hp orb for example. A player has x hp. That hp as a percent x/100 will influence the percent of which the orb is filled from bottom to top red. You can see in the gif above I have this working for 'part' of the circle. The problem is the other sections.

My method for drawing the circle in this example is drawing the 0->15degrees side arc using sin/cos and reflecting it 8x...I posted earlier 3-4 other circle drawing methods, but I'm using the cos()/sin() one here for accuracy's sake. To fill in the circle I am using the line() method and extending it to the other side so I only need 4 instances. I don't fully understand the rect() method and have had issues getting it to look right (I assume u draw a square right center of the circle but the corners usually stickout and look off...maybe that assumption is the problem).

[ Continue Reading.. ]

4 comments



Cart #jfowobora-1 | 2022-04-01 | Code ▽ | Embed ▽ | No License

I've been looking at how to draw circles that mimic the elegance of circ(). From the bbs that led me to
https://www.lexaloffle.com/bbs/?tid=29976
https://en.wikipedia.org/wiki/Talk:Midpoint_circle_algorithm

So I tested
Minsky/Midpoint/x,y=sin(),cos() against circ()
The verdict was the midpoint algorithm was the best alt method. But none of them r close to being as efficient as circ()..so I don't understand...how does circ() work? I especially don't understand cause the previous bbs link to the Minsky said it was superior to circ()...my tests say its not...but the posts r 5 years old so...has circ() been updated since maybe? Or what am I missing? All I did in my test is draw 100 circles and look at the values via ctrl+p...and the findings were explicit.

[ Continue Reading.. ]

5 comments



id=stat(31) identifies keypress_q as id="q" and keypress_a as id="a". Btn(5,1) identifies itself as keypress_q and keypress_a. How do I separate keypress_q to work via id=stat(31)="q" and btn(5,1) to work 'only' with keypress_a?

id=stat(31)
if btn(5,1) and id~="q" then... --input for keypress_a
if id=="q" then... --input for keypress_q

That 'would' work...but the problem is stat(31) works like btnp() when I need it to work like btn()...but the poke methods of making btnp() work like btn() don't seem to apply to stat(31)! So I'm presently stuck in a situation where I can be pressing keypress_q and yet id~="q"! The obvious way around this is to just use id=="a" for keypress_a; id=="q" for keypress_q....but again, they work like btnp, so this doesn't work if I want to use keypress_a for standard smooth wasd player movement.

The intent is to basically utilize the existing buttons of player 0 and player 1....and add the functionality of stat(31) to get even more keys. I don't necessarily need the other keys to have the same functionality as btn(), they can just be 'single tap' style keys...I'll use them as like rpg skills that go on cooldown right when they are used. Player movement via wasd though needs the functionality of btn(). But again, the problem is the overlap....specifically with those btn(4/5) keys since they have more than 1 natural input (seen below), when I want to choose just 1 natural input and use stat(31) to utilize the other.

[ Continue Reading.. ]

6 comments



I need some help creating an absolute value function that utilizes bits to work.
My current understanding is pico8 is either 32 or 16 places. I don't quite understand which value I would use here.

If someone can clarify that would be good. For the sake of explanation, lets say its 6 bit.

v=2
000 010 --binary form of 2 in 6 bit
v=-2
111 101 --binary form of -2 in 6 bit 

So my understanding is the formula is something like:

mask=v>>number_of_bits_in_v -1
v=(v+mask)^mask

where number_of_bits_in_v=6 and v=2

And the idea is in the case of v=-2 we are adding one to it..cause all the bits to shift over. So given the above formula is subracting one....I have to know whether the number is positive or negative ahead of time and use either -1 or +1? Not sure if that'll be an issue or not.

This leads to a function like:

function absolute(v,ttl_bits)
local mask=v>>ttl_bits-1
return (v+mask)^mask
end

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=108221#p)
4 comments



Cart #tubisapame-0 | 2022-01-28 | Code ▽ | Embed ▽ | No License


I'm trying to figureout how to create parabola/bezier-curve/quadratic (i.e. grenade lobbing) movement based on the player's velocity dx/dy. I'm familiar how to do this for a player's speed, and the cart shows the setup for speed as a functioning baseline. In the cart I defined a player who can move around with the arrow keys. When they hit x they bunny style hop moving to the right using the quad() function. The system freezes the movement of the player while the hop completes, so its always the same movement pattern.

Speed relies on absolute movement and coordinates...with quad() the player will start somewhere defined p0...move along a curve defined by point p1 and endup at p2. The cart math is based on augmenting the x/y player values directly. Velocity is different though, and I can't figureout how to make the same example work for the dx/dy in the cart.

[ Continue Reading.. ]

8 comments



Nothing I try seems very active. I went through...slack...twitter.....here....stack exchange. And the time delay between getting any answers, if any, is excruciatingly ineffective. Are there more active communities I could get help from that I haven't tried?

Here and there I have little questions I need help with. Mainly syntax related, I don't need somsone to go through ALL my code or anything just 1 liners here and there. For small questions while writing your code, what is the best way to get answers asap? Was hoping for a chatbox or irs or something.

1 comment



I'm having a really hard time with initiating if statements using multiple booleans. It seems I initiate one but then it stays and I can't figure out how to write them properly if I'm dealing with multiple.

In this example I'm trying to set 3 gamescreens with a timer for the 2nd.
The default screen is titlescreen; the initated one on button press is titlescreen1; and then i want gamescreen to happen automatically when the timer finishes.

Problem is gamescreen doesn't initiate and I don't understand why.

countdown=5
time_diff=0
titlescreen=true
titlescreen1=false
gamescreen=false

function _init()
end

function time_lapse()
if time() - time_diff > 1 and countdown > 0 then
countdown-=1
time_diff=time()
end
end

function _update()
if btn(4) then titlescreen1=true end
if titlescreen1==true then time_lapse()
if countdown==0 then gamescreen=true end
elseif gamescreen==true then
end
end

function _draw()
cls()
print("one is happening",33,33,14)
if titlescreen1==true then cls() print(countdown,15,15,14)
elseif gamescreen==true then
cls()
print("gamescreen is active",33,33,14)
end
end

1 comment



Basic movement can be facilitated through:
if btn(0) then x-=1 end

But when I add sfx:

if btn(0) then x-=1 and sfx(0) end

It always generates an error as soon as that button 0 is pressed. Why is that? If x then y and z end. Is there something wrong with that syntax? Or is it related to sfx not working in this way?

And why is it when I clarify with brackets it doesn't even run!? Am I clarifying that my syntax is wrong before teh game starts? That's funny.
i.e.
if btn(0) then (x-=1 and sfx(0)) end

1 comment



Edit: not sure how I'm expected to display multiplication using the syntax here, but assume there's a X or star or whatever between 15 and i etc.

I was trying to initiate this statement here, which I can do:
for i=1,4 do
print(i, 15i-14, 15i-14, 14)
end

But then I wanted to move the diagonal array of 4 numbers with the arrow keys around the screen. I tried the code below but keep getting errors. I'm guessing my argument is setup wrong and I can't call i as the same variable in all these statements and make it work...? Can someone help me understand the immediate problems with the code, and then afterwards if viable suggest an alternative method of doing so. I'm still learning so my immediate concern is figuring out what is wrong here specifically.

function _init()
j= {
x=15i-14,
y=15
i-14
}
end

function _update()
if btn(0) then j.x-=1 end
if btn(1) then j.x+=1 end
if btn(2) then j.y-=1 end
if btn(3) then j.y+=1 end
end

[ Continue Reading.. ]

2 comments