Banner
Views: 873,655,498
Time:
22 users online: aaa,  Anorakun, AyGaAlPa, buggy789, callmeCMDR, chickaDEE Magazine, endlessrevolt, Gammed Z, Golden Yoshi, Gulaschko, MegaSonic1999, Phyll, PlagueRatofDoom, qantuum, Rykon-V73, shadowboyultra, SLBros., slopcore,  Tahixham, Wyatt, yoshifanatic, Yoshioshi_ - Guests: 88 - Bots: 62 Users: 48,646 (2,410 active)
Latest: zerociaran
Winter C3 2021 Content Spotlight
HaruMKT's "Hybrid Front Project Teaser"!
Not logged in.
[SOLVED] Custom Block: Blank tile generated on wrong position
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - [SOLVED] Custom Block: Blank tile generated on wrong position
Pages: « 1 » Link
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.

--------------------
Why are you like this!?
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.

--------------------
Why are you like this!?
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^^
Pages: « 1 » Link
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - [SOLVED] Custom Block: Blank tile generated on wrong position

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2021 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks