Log In  

Is there a way of changing the origin point of a sprite/object to be central?

in Love i would use getHeight()/2

P#35066 2017-01-06 08:59 ( Edited 2017-01-06 15:23)

I have been working on a little project aimed at teaching myself the LUA language one bit at a time.
to this end I used the basic timer I developed to control 4 sprites animation.

I have also created a little hitbox around it so that it can be shot and the animation stop.

P#32407 2016-11-12 04:56 ( Edited 2016-11-12 09:56)

I have been trying to work on a game using pure code. This, however, is causing more headaches than required. So I went back to making sprites lol.

--Original Size

--2x Size

P#32295 2016-11-07 09:59 ( Edited 2016-11-07 16:29)

Cart #31375 | 2016-10-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

In more of a attempt to learn Pico 8 simply from the manual I have created a enemy that cases the player.

There is nothing very exciting to this as it is a test of the logic. Essentially the enemy looks to see where the player x and y is. it then minuses or adds 1 to its own location depending on if it is > or < the target location on the x and y.

P#31376 2016-10-21 08:24 ( Edited 2017-01-28 10:45)

Cart #31327 | 2016-10-20 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Who says that smashing your head against a brick wall for a while doesn't yield results.

So in my attempt to go teh old school I decided to see how well I could implement some hit detection. Using all code with hard coded images.

First issue. The centre point is literal.

Yeah this means that trying to keep the ball in play field will always result in some overhang. Which doesn't look good.

Enter arrays!

and the second issue. They are a twat to work with. In a good kind of way.

I ended up making some markers to make a kind of hit point. Once this point goes past the screen bounds it keeps the ball in the field.

as the markers leave the field it forces the middle of the ball to a neutral area in the field close to the edge. Giving the impression the ball is staying put.

Anyway. Have a play and look at the code. I have tried to annotate as much as possible and left debugging info on the screen.

P#31329 2016-10-20 15:17 ( Edited 2016-10-21 23:59)

I got really annoyed with myself trying to visualize coordinates on the screen. So I used my l33t excel skills to throw a grid together with some reference numbers.

I am doing this bastard oldschool.

P#31288 2016-10-20 07:23 ( Edited 2016-10-20 11:23)

Cart #31219 | 2016-10-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Just a basic timer that I made to count seconds, minutes and hours. Plan on using it in a game to time special states.

P#31220 2016-10-19 08:21 ( Edited 2016-10-20 19:20)

This really does feel like the old days. Where you would turn on a BBC Micro, C64 or MS-DOS computer and then get stuck in.

When I saw the program does peeks and pokes I nearly wept. Out of nostalgic joy and flashbacks to getting the C64 to bloody do what I wanted it to lol.

I love the little pixel editor. Reminds me of SEUCK in the way it works. And the Wave editor is like something I used on the Amiga.


P#29974 2016-10-04 11:36 ( Edited 2016-10-04 15:36)

Could be me been tired. But I don't get why my character is falling through the map.

I thought I had done some basic collision detection, after following some tutorials. However it doesn't seem to work and my character simply falls straight through the map.

--player variables
        --initial sprite start
        --point and velocities



function _update()

--left and right movement
if btn(0) then --left

if btn(1) then --right




local v=mget((p1.x+4)/8,(p1.y+8)/8)


if p1.vy>=0 then
        --look for a solid tile
        if fget(v,0) then
            --place p1 on top of tile
            p1.y = flr((p1.y)/8)*8
            --halt velocity
            p1.dy = 0
            --allow jumping again


function _draw()

P#29948 2016-10-04 08:42 ( Edited 2016-10-04 15:31)


Just bought Pico 8 today. Really impressed with it and reminds me of the days I would code on my C64.

However when I switch from full screen it crashes. Not reason given. Just a crash message.

I am running Windows 10.

P#29881 2016-10-03 13:19 ( Edited 2016-10-04 08:10)

Follow Lexaloffle:        
Generated 2020-05-25 15:49 | 0.092s | 2097k | Q:56