Language…
19 users online: Alex No, ben15420, DanMario24YT, gemstonezVA, GiraffeKiller, Gmario37, Green, GRIMMKIN, Hidincuzimsmokin, JudithPrietht, Metal-Yoshi94, MorrieTheMagpie, rafaelfutbal, Ray Hamilton, Sniwott, Spedinja, VoidCrypt, WhenUnique, xhsdf - Guests: 280 - Bots: 485
Users: 64,795 (2,371 active)
Latest user: mathew

[SOLVED] Custom Block: Blank tile generated on wrong position

I am currently trying to write a block which gets destroyed on contact with a sprite. I am using the subroutine $BEB0 to create a blank tile on the block's position and I am loading the sprite's position into $98-9B (the player's position).
Everything is working out except the fact that the tile gets always created on the left from the sprite.
Is there a way to detect if the sprite touches the left or right side of the block or is there a different way to destroy the block?

Here is the my code (I have left out the block where the player's position is pushed into the stack and pulled from the stack)
Code
    LDA $14D4, X    ;\
    XBA             ; |
    LDA $D8, X      ; | Store sprite Y position
    REP #$20        ; | into player Y position
    STA $98         ; |
    SEP #$20        ;/
    LDA $14E0, X    ;\
    XBA             ; |
    LDA $E4, X      ; | Store sprite X position
    REP #$20        ; | into player X position
    STA $9A         ; |
    SEP #$20        ;/

    LDA #$02        ;\
    STA $9C         ; | Gernerate blank tile
    JSL $BEB0       ;/
Wait, unless I'm misunderstanding something... why are you storing the sprite's position into the player's position? (btw you shouldn't store stuff to RAM addresses that already have a purpose) There are labels in GPS dedicated to sprite contact (SpriteV and SpriteH) and they already take care of running code on touch, so you don't need to play with positions at all. Pretty sure a JSL $00BEB0 will also take care of the current block by default, so everything you need is just the final 3 lines.
It's easily the best thing I've done
So why the empty numb?
These were my first lines, but when a sprite touched the block, the tile got generated one tile below the player
Can you post the full block code?

To be fair I haven't messed around with blocks for a while, so I may be misremembering how the block generation routine really works, but it sounds really weird to me that the block generated is displaced like that.
It's easily the best thing I've done
So why the empty numb?
I don't know either how it should work. I have only written the first three lines, started debugging the game and discovered that $00BEB0 is using the player's position to generate the block
GPS includes a routine to set the parameters used by $00BEB0 when touched by the sprite. It should be enough to do this
Code
%sprite_block_position()
lda #$02
sta $9C
jsl $00BEB0
Yes, that worked. I have only two additional questions. Where can I find the routines from GPS and can I see the code from these routines?

I have found it, it's in the gps/routines folder. Thank you very much^^