Log In  
Log In  

@kikendo

Follow
Follow

Hello everyone, it's been a while, life gets in the way and my little pico-8 project gets pushed away, but here I am again with more questions.

I got to the point where I basically have all the game elements I need running (I think), and I need to start building levels, but I have no idea how to go at this really.

My game is a flip screen type, 8 screens wide per level.
Each level will of course have an increasing number of features with different attributes.
Some of them are collectables (two types), some of them are enemies (3 types)

I know there's two ways I could approach this:

  • Have a fixed amount of levels that are all the same and tweak them difficulty-wise as I see fit, by hand
  • Have the levels be created procedurally

I don't have the foggiest idea about procedural generation of anything, so I don't think I would understand ANY explanation about that route. Although it would be nice to learn eventually and maybe change the game to do that in the future, at this point I think option 1 is my only course of action for the time being.

With that in mind, how would you approach this task?

My main idea was to have an object level{}, which would have as elements each level (up to 15 or whatever I decide I can have), and each level element would have the data I need, in some format.

i thought maybe an array of numbers representing each level would tell it what each screens has, but haven't really figured that one out yet.

Looking forward to hear your ideas!

P#56678 2018-09-14 16:08 ( Edited 2018-10-19 21:56)

Hi everyone,

I hope you can help me out with this one as I have no idea how to approach it.

I have a player character that moves across a screen, and there is an element I am drawing that sometimes should be behind the character and sometimes it should be in front. Basically, if my character is around its area (collided with it) and I press a button, the sprite should come on top of the character. When I press another button, the sprite goes back to being behind the character.

What would be the best way to achieve this, since I cannot dynamically change the order in which things are written? (or can I?) I read some hints at the forum some time ago regarding the use of flags, but I have no idea how this would work (and never used sprite flags before).

Any help appreciated!

P#54104 2018-07-12 13:08 ( Edited 2018-07-13 13:54)

Hi pico8'ers, it's me again. Sorry!

Today I am wondering what the best approach would be to check if a sprite/object has touched a line and act accordingly.

Take the following example:
Let's say I made this 45 degree slope and I have a character that can walk to it or jump to it from wherever. I want that line to be "solid" and affect the character's behavior.

Illustrated:

How would I go at this, I have no idea.
I have a collision system in place in my game, but it checks bounding boxes.
Of course I don't want to make bounding boxes of 1x1 and check against all of them, that sounds slow and stupid.

I think maybe what I need here is "raycasting" but I never in my life have done anything like that and have no idea where to begin. I don't even know if that is what I am looking for.

I don't want to make slopes of varying angles, it will always be a 45 degree slope. I Am hoping this also would make things easier.

I didn't find any cart on the BBS that does exactly what I want from where I could look at some code. Maybe I didn't look hard enough.

Any help appreciated!

P#51954 2018-04-24 14:32 ( Edited 2018-04-27 21:00)

So I implemented the following jump function in my game:

function jump(sp,vel,factor)
    for i=1,factor do
        player.sprite = 12
        player.velocity+=sp
        if player.y<=player.origpos then
            player.y+=(player.velocity*player.speed)
        else
            player.velocity=vel
            player.y=flr(player.origpos)
            player.sprite = 0
            player.jumping = false
        end
    end
end

The problem I am having here, is that the Y of the player every second jump is equal to player.origpos+0.24

I moved stuff around because what I feel is happening is that the routine is entering some condition one time too many, but why does it every second frame? Does it have to do with the fact that I am calling "factor" twice? And how would I fix this problem?

The difference is every second jump, the character ends up one pixel above the floor, and let me tell you, it does NOT let my OCD rest peacefully :D

Any help appreciated!

P#51788 2018-04-19 16:40 ( Edited 2018-04-24 18:54)

I'm trying to make a bunch of rectangles that rotate around a given point, my code so far is this

function _update()
    timer+=0.01
    velocity_x=cos(timer)
    velocity_y=sin(timer)
    for vect in all(rotographic) do
        vect[1]+=velocity_x*radius
        vect[2]+=velocity_y*radius
        vect[3]+=velocity_x*radius
        vect[4]+=velocity_y*radius
    end
end

function _draw() 
    cls(0)
    for v in all(rotographic) do
        rectfill (v[1],v[2],v[3],v[4],flr(rnd(15)+1))
    end
end

"rotographic" is a table in which each cell contains a 4 value vector with the x and y positoins of origin and destnation to feed to rectfills. So far this works fine making the squares, however, all they do is rotate together, around their own center if I am not wrong.

What I want to achieve, is for the each rect to rotate around a given center (let's say 64,64 to exemplify) so in the given example, what would happen is, the outer rects will rotate around a bigger radius than the inner ones.

I know I'm failing at math here (no surprises) so I hope you guys can nudge me in the right direction!

I read this very helpful article, but I am failing to figure out how to apply its logic to more than one element in the data structure I have.
http://endlessillusoft.com/rotating-around-a-point/

P#51470 2018-04-09 21:17 ( Edited 2018-04-10 04:54)

Hi everyone,

In a try to make my code cleaner, I am trying to get all the junk I was putting in _update into its own function, but failing.

I copy pasted the exact same code and put it in a function called "game_update", then called "game_update()" from the _update function, and I get a runtime error: Attempt to call global 'game_update' (a nil value)

If I copy that back into update, the game works.

I read that in lua the order you define things in is important. My init, update and draw are at the bottom of the code so this shouldn't be the problem (I moved them atop and also didn't work).

Any idea what could be happening here??

P#51042 2018-03-30 11:03 ( Edited 2018-04-02 16:00)

Has anyone beena ble to run PicoPi on a RaspberryPi Zero?
https://guillermoamaral.com/read/picopi/

It says to copy everything to a card and boot, but I got mine stuck on a black screen, nothing happens.

I want to make a standalone device booting straight to pico8 and this seems like the only option.

P#49117 2018-02-09 10:42 ( Edited 2018-03-21 16:39)

X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2018-12-11 06:42 | 0.044s | 2097k | Q:22