Author Topic: Checking location in Tilemap and changing GDB value.  (Read 10925 times)

0 Members and 1 Guest are viewing this topic.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Checking location in Tilemap and changing GDB value.
« on: March 08, 2011, 11:12:48 pm »
This is old, I figured this out.
Spoiler For Spoiler:
So...

I would like to test if my cursor (x,y) is on my sprite, no variables right now and its always at the same position. I would like it to change Pic pointers. From Say Pic0R to Pic0B, but the catch is that it does it to adjacent tiles as well.. I've even kind of lost myself here...

Um... Here.

x = red
y = blue
z = green

XXXXX
XYYYX
XYXYX
XYYYX

now if you 2nd the x in the middle of the Ys, the Ys change to Xs. But I have no clue how to change these in Axe or even check if I clicked in the correct space...
I'll ask about the menu after I get this answered...

Now that I finished that... How would I check what tile I am on and change tiles around it? Okay I have
X = tile 0
Y = tile 1
x = tile 0 with cursor
XXXXX
XYYYX
XYxYX
XYYYX

if I second x, i want to check the values in a square around it, and up them by one. like 00 -> 01 and 01 -> 02 and 02 -> 00. But the thing is, each tile will have a different way they change the surrounding tiles. If I could figure out one, i could figure out the rest. I used Nemo's tilemapping example (http://ourl.ca/7512/130274) and made a few changes so that it did a 5x4 grid.
« Last Edit: March 09, 2011, 04:03:47 pm by jkag »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #1 on: March 08, 2011, 11:19:07 pm »
So...

I would like to test if my cursor (x,y) is on my sprite, no variables right now and its always at the same position. I would like it to change Pic pointers. From Say Pic0R to Pic0B, but the catch is that it does it to adjacent tiles as well.. I've even kind of lost myself here...

You can't really test if you're on a sprite directly (except with a mass of pxl-Test('s), but you can store the X- and Y-positions of the object, then test to see if it's within 8 of the X- and Y-value of the cursor.




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #2 on: March 08, 2011, 11:26:53 pm »
I'm confused as to how you have red, blue, or green anything on a monochrome screen ???
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #3 on: March 08, 2011, 11:32:18 pm »
Oh, well I'm remaking a game. It was easier for me to think of it that way lol. Okay, I figured that. I suppose i could figure which one i am on because X will equal 8*column and same with Y... well row. But how about changing the "color" of them, or do I have a mass of different states of them?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #4 on: March 08, 2011, 11:35:25 pm »
Oh, well I'm remaking a game. It was easier for me to think of it that way lol. Okay, I figured that. I suppose i could figure which one i am on because X will equal 8*column and same with Y... well row. But how about changing the "color" of them, or do I have a mass of different states of them?

If everything's confined to a grid, that's a great idea. Tilemaps make things a lot easier :)
« Last Edit: March 08, 2011, 11:35:45 pm by Deep Thought »




Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #5 on: March 08, 2011, 11:48:04 pm »
No, no tilemap. Just drew all... 20 sprites lol. But reading Cmpwn's tutorial on Tilemapping right now. I only have 3 sprites so...

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #6 on: March 09, 2011, 07:32:10 am »
It would be easiest to have the tilemap somewhere in ram, and have values that correspond to the sprites (With only 3 sprites, you can fill an entire 12*8 sprite screen in only 24 bytes @ 2 bits per tile), and change them in the stored data, and redraw when needed.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #7 on: March 09, 2011, 03:08:38 pm »
Okay... So I followed Cmpwn's tutorial... And got some strange results? Can this maybe because 1) How my sprites are formatted in "Pic0T" or 2) Just the version of Axe parser?

I'm just totally lost lol... My grid is a 5x4 grid, only 20 sprites on the screen at a time (not including the title i did as a sprite, which is 5 sprites).

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #8 on: March 09, 2011, 03:20:53 pm »
Isn't SirCmpwn tutorial for Axe 0.07 or something? I am not convinced it is still valid for current versions of Axe anymore.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #9 on: March 09, 2011, 03:22:18 pm »
D: Oh no lol. How shall I learn now!? lol.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #10 on: March 09, 2011, 03:23:21 pm »
I don't know. Hopefully someone can help you soon. I think it would be best to rename the topic title to reflect it is now about tilemapping, check older topics about tilemapping and start a new one if you can't find anything, though.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #11 on: March 09, 2011, 03:28:35 pm »
I found a simple little thing from nemo on how to do it, gonna try it now. I'm gonna rename the topic anyhow because the title is confusing lol

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #12 on: March 09, 2011, 03:29:28 pm »
Ok good to hear. Good luck! :D

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Testing Location and a Menu (that also includes the first thing)
« Reply #13 on: March 09, 2011, 03:36:19 pm »
Yep, It works but it will not work on a 5x4 set, and returns crap on the 5th column. It will do a 4x5 though, but that doesn't work for my game :/

edit: Fixed it :D  :D
« Last Edit: March 09, 2011, 03:41:18 pm by jkag »

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Checking location in Tilemap and changing GDB value.
« Reply #14 on: March 09, 2011, 04:04:18 pm »
Updated :D

sorry for double post :O