﻿ Help with tilemap collision?
22 May, 2013, 04:06:37
 OmnomIRC You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

 Pages: 1 [2]   Go Down
 Author Topic: Help with tilemap collision? -  (Read 1164 times) 0 Members and 1 Guest are viewing this topic.
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)

Offline

Gender:
Last Login: 20 May, 2013, 05:36:22
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114

Total Post Ratings: +121

 « Reply #15 on: 12 January, 2012, 00:02:11 » 0

haha that's totally fine. Everyone forgets these things, most especially me.
 Logged

Completed Projects:
>> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
>> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.

Spoiler for Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)

thydowulays
LV4 Regular (Next: 200)

Offline

Gender:
Last Login: 19 March, 2013, 16:22:53
Date Registered: 02 November, 2011, 04:41:42
Location: Greenville, SC
Posts: 184

Topic starter
Total Post Ratings: +11

 « Reply #16 on: 12 January, 2012, 00:46:41 » 0

Wait, I have a question. If I had the routine GT, with {r2/8*12+(r1/8)+GBD1}=r3, and I did this:
If sub(GT,X,Y-8,2)
End
Would that test to see if the tile had a number 02? Like I could do this:
If sub(GT,X,Y-8,2)
Y-8->Y
Pause 500
End
ElseIf sub(GT,X,Y-8,3)
Pause 500
End

Nevermind, I got it. However, does anyone know a routine to say, move a tile up or down, or left or right? Like, edit the little [01000000000000001]->GBD1 sorta thing via a routine in game?
That would make it so I could move through tile 02, but not tile 03. Would that work?
 « Last Edit: 12 January, 2012, 00:53:07 by thydowulays » Logged

Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus

/image/33080.png[/img]
LincolnB
Check It Out Now
LV9 Veteran (Next: 1337)

Offline

Gender:
Last Login: 20 May, 2013, 05:36:22
Date Registered: 02 May, 2011, 00:56:28
Location: Utah Valley
Posts: 1114

Total Post Ratings: +121

 « Reply #17 on: 13 January, 2012, 00:44:27 » 0

yes, but you'll want to make a copy of your map data and modify that, so you don't screw up your map for permanent.

To acces the Yth element down and the Xth element across, go like this:

{Y*WIDTH_OF_MAP + X + START_OF_MAP_DATA}

So, to move a tile to the left, say:

 12 {Y*WIDTH_OF_MAP + X + START_OF_MAP_DATA}->{Y*WIDTH_OF_MAP + X-1 + START_OF_MAP_DATA}

And so on
 Logged

Completed Projects:
>> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
>> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.

Spoiler for Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)

C0deH4cker

Offline

Gender:
Last Login: 19 December, 2012, 22:22:42
Date Registered: 18 October, 2011, 23:19:08
Location: \$9D95
Posts: 258

Total Post Ratings: +10

 « Reply #18 on: 13 January, 2012, 01:13:41 » 0

In my programs where I want to edit my maps, I first copy the maps to L1 or some other free ram area during level loading. I usually have three map functions:

 1234 DrawMap(mapPtr, tilePics)GetTile(mapPtr, x, y) .x and y are actual screen coords. Function just divides each by 8 to get the tile that contains the point specified.SetTile(mapPtr, row, col, value)

Then you can access and modify your map very easily.
 Logged

parserp
Hero Extraordinaire
LV10 31337 u53r (Next: 2000)

Offline

Gender:
Date Registered: 08 September, 2011, 02:01:43
Location: Here.
Posts: 1421

Total Post Ratings: +80

 « Reply #19 on: 26 January, 2012, 01:09:49 » 0

hmmm, I can't think of a good way to erase a tile from the map. Is there a fast way to draw it every frame?
Every way that I've tried it, it is too slow.
 « Last Edit: 26 January, 2012, 01:09:55 by parser padwan » Logged

ticalc.org | Cemetech | TI-Freakware | casiocalc.org

My New Website!
Spoiler for The Rest:

A useful tool
Spoiler for bands:
Five Finger Death Punch
Disturbed
Slipknot
Avenged Sevenfold
Breaking Benjamin
Skillet
30 Seconds to Mars
thydowulays
LV4 Regular (Next: 200)

Offline

Gender:
Last Login: 19 March, 2013, 16:22:53
Date Registered: 02 November, 2011, 04:41:42
Location: Greenville, SC
Posts: 184

Topic starter
Total Post Ratings: +11

 « Reply #20 on: 26 January, 2012, 04:42:04 » 0

Parser, to erase an individual tile from the map, you basically take leafy's routine:
 1234 Lbl GT{r2/8*12+(r1/8)+GDB1}Return
And turn it into this:
 1234 Lbl ST{r2/8*12+(r1/8)+GDB1}->r3Return
Then, you would just have to do ST(X,Y,0 and the tile at position X,Y will be converted into 00.
What do you mean by fast drawing?

EDIT: Leveled up! W00t!
 « Last Edit: 26 January, 2012, 04:42:35 by thydowulays » Logged

Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus

/image/33080.png[/img]
leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)

Offline

Gender:
Last Login: 20 May, 2013, 21:59:01
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545

Total Post Ratings: +371

 « Reply #21 on: 26 January, 2012, 05:01:13 » 0

Did you mean:

 1234 Lbl STr3->{r2*12+r1+GDB1}Return

Also I think he meant actually erasing the tile from the screen. Parser you can do that by drawing a Rect( and a RectI( at the coordinates of the tile.
 Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)

Offline

Gender:
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022

Total Post Ratings: +1019

 « Reply #22 on: 26 January, 2012, 05:14:01 » +1

Also I think he meant actually erasing the tile from the screen. Parser you can do that by drawing a Rect( and a RectI( at the coordinates of the tile.
...or a single Pt-Off() if the tile is 8x8.  If its smaller than 8x8 you can use Pt-Mask()r to erase and redraw the new tile just like Pt-Off().
 Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
parserp
Hero Extraordinaire
LV10 31337 u53r (Next: 2000)

Offline

Gender:
Date Registered: 08 September, 2011, 02:01:43
Location: Here.
Posts: 1421

Total Post Ratings: +80

 « Reply #23 on: 26 January, 2012, 05:34:41 » 0

actually yes, I was referring to physically erasing a tile from the buffer. I'll try trying using 'Rect' and 'Pt-Mask'. Thanks guys!
 Logged

ticalc.org | Cemetech | TI-Freakware | casiocalc.org

My New Website!
Spoiler for The Rest:

A useful tool
Spoiler for bands:
Five Finger Death Punch
Disturbed
Slipknot
Avenged Sevenfold
Breaking Benjamin
Skillet
30 Seconds to Mars
Eiyeron
LV7 Elite (Next: 700)

Offline

Gender:
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552

Total Post Ratings: +19

 « Reply #24 on: 08 February, 2012, 12:19:35 » 0

Just a little optimisation:

x+1->x

Becomes:

x++

Same with x--

But is faster
 123 getKey(4)?Y--End

than?
 1234 If getKey(4)Y-1->YEnd

i think there should be many bytes and cycles won, but not much
 Logged

kindermoumoute

Offline

Last Login: 20 May, 2013, 23:02:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 836

Total Post Ratings: +51

 « Reply #25 on: 08 February, 2012, 14:03:44 » 0

But is faster
 123 getKey(4)?Y--End

than?
 1234 If getKey(4)Y-1->YEnd
Nope, that's the same.
 Logged

Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%
Eiyeron
LV7 Elite (Next: 700)

Offline

Gender:
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552

Total Post Ratings: +19

 « Reply #26 on: 08 February, 2012, 22:29:39 » 0

Really? I thought that would be faster, or lighter...
 Logged

hellninjas
LV7 Elite (Next: 700)

Offline

Gender:
Last Login: 20 May, 2013, 23:07:31
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 615

Total Post Ratings: +17

 « Reply #27 on: 08 February, 2012, 22:30:32 » 0

This has been alot of help!
 Logged

Spoiler for Hidden:
Eiyeron
LV7 Elite (Next: 700)

Offline

Gender:
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552

Total Post Ratings: +19

 « Reply #28 on: 08 February, 2012, 22:31:55 » 0

You'r welcome!
 Logged

 Pages: 1 [2]   Go Up