Author Topic: YAMGT  (Read 97269 times)

0 Members and 2 Guests are viewing this topic.

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: Tio
« Reply #240 on: February 15, 2011, 03:52:17 pm »
The plain grey ones kill you instantly :D. The thing that's really cool about them is that they actually aren't grey, they're really a 2 frame animated checkerboard tile! That's really a pretty cool way to do it, Darl, props. Also, when I post it tells me that the max number of attachments is 50 :o

Anyway. Yeah, so if you look at the code, it's basically an optimized version of
Code: [Select]
Y/4*24+(X/4)+L1->G
Y/4*24+(X+3/4)+L1->F
Basically what it does, is it reduces your pixel coordinates to tile coordinates (the divide by 4). The Y value is multiplied by 24 because that's how wide the map is (It's now treated as a simple array). I use two values to check which tile the left and right side of the character is in. And now you can add or subtract from F and G to get different tiles; eg {F+24} is like adding one row's worth, and hence one tile down.

inData is a smaller way of doing If var=something or (var=something else) I believe the line reads If inData({F}+1,[040600])? So since both values 3 and 5 are respawn points, it checks if the current tile is either 3 or 5. But the data needs to be zero-terminated, which is why I added the +1 there. (and then scaled up the appropriate values)
Yeah I know. When I made Reuben Quest I actually did grayscale like that: by swapping a checkered pattern extremly fast to create an illusion of gray. That's similar to Axe's 3 lv grayscale actually.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #241 on: February 15, 2011, 04:35:51 pm »
Ok, I've gotten string editing implemented.  The tilemapping thing is still a confusion though ???
Should I ask in a different topic?
« Last Edit: February 15, 2011, 04:57:42 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Tio
« Reply #242 on: February 15, 2011, 05:18:28 pm »
I didn't take too close of a look at your code, but here is what I can suggest:

In SandLand, the way I moved from not-scrolling to scrolling was actually very simple. What I did was simply use the player's X and Y as offsets to figure out by how much to shift the tilemapper's window, and draw the character in the same place the whole time. Here is the tilemapping code...(unoptimized for readability, and btw these are 8x8 tiles)
Code: [Select]
For(A,0,12)  //For 13 columns...
For(B,0,8)    //For 9 rows...
{Y/8          //Take the Y position, divide by 8 to get the tile offset
-4           //But the character is in the middle of the screen, so -4 tiles worth
+B*32     //Add tilemapper's Y value, then multiply by 32 because that's how many tiles wide my maps are
+(X/8+A)-6 //Same as before but with X
+L1}->C  //Level data is stored in L1
Pt-On(A*8-(X^8),B*8-(Y^8),C-1*8+Pic1 //X^8 and Y^8 are the pixel offsets of the player
End
End
End
« Last Edit: February 15, 2011, 05:22:11 pm by squidgetx »

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #243 on: February 15, 2011, 06:25:47 pm »
Yeah, I think I have the prob figured out (it was re-drawing the row/column every time it shifted), and have kind of an idea of how to fix it.
THere was another part in tio that had me confused for a while...in the editor, the min( token somehow limited the selector.  How doea that work?
« Last Edit: February 15, 2011, 06:27:20 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Tio
« Reply #244 on: February 15, 2011, 06:30:58 pm »
All right people, listen up! Awesome optimization tip right here ;D (Thanks to Runer112)

The most efficient way to limit selectors is as follows:
Code: [Select]
getKey(3)-getKey(2)+A //If right, +1. If left, -1
!If +1  //If A+1=0, that is, if A = -1. Right now, hl=A+1
+1      //+1 to value in HL
End
-1  //Before, hl=A+1. So we have to -1 to it. If A=-1 before, now the value in HL=0
min(,max value)->A  //Leaving the first argument blank inserts hl in. So basically, this compares A and the maximum value and returns the smaller                        one.
« Last Edit: February 15, 2011, 06:33:06 pm by squidgetx »

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Tio
« Reply #245 on: February 15, 2011, 06:59:32 pm »
I herd you liek hard levels so I raise you one and upload my own.
In the days of Mario 1.2 I used to make a ton of awesomely impossible levels. I lost one of my best works, called "Legendary" when I got ram cleared.
can't wait until you add support in the editor for multiple levels :D
rename it to TIOLVL.8xv i guess.
« Last Edit: February 15, 2011, 07:02:18 pm by leafiness0 »
In-progress: Graviter (...)

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #246 on: February 15, 2011, 07:01:52 pm »
OK, thanks ;D
Still can't figure out the tilemapper though.
When scrolling both horizontally and vertically, there's display issues.
To test: make a tio level using any of the versions, then run this.  It uses the Tio map for data.

If someone can screenshot it that would be great ;)

btw leafiness, that's done, next version (which, if I don't include scrolling, is ready for release save a glitch in the main menu)
levels possible from 00 to 99.

btw @leafiness0 the level's good, aside from the cheap death at the beginning, but it will probably be included as like a final level or something.

attached is (non-playable) level that really shows the graphical problems...yay :P

EDIT have some code
Code: (STILEMPR) [Select]
:.DTILEMPR
:[F0F0F0F000000000]→Pic0N
:[A0A0505000000000]→Pic1J
:[6040206000000000]→Pic1S
:[6040604000000000]→Pic1F
:[9000009000000000]→Pic1R
:[A050A05000000000]→Pic1D
:[000C030000000000]→Pic1W
:DiagnosticOff
:"vTIOLVL"→Str1
:GetCalc(Str1)→P
:Return!If P
:conj(P,L1,384
:0→N→O→I→J-1→E
:.I and J are coordinates of top left corner
:.N and O are tile offsets
:
:ClrDraw
:.draw init image
:For(Y,0,15
:Y*4→T
:For(X,0,23
:X*4→S
:E+1→E
:sub(DRW
:End
:End
:DispGraph
:Repeat getKey(15)
:Repeat getKey(0):End
:If getKey(54)
:ClrHome
:.display stuff
:Disp "random info",i,"I",I►Dec," J",J►Dec,i,"N",N►Dec," O",O►Dec
:While getKey(54):Pause 10:End
:End
:
:If getKey(1) xor (getKey(4))
:.vert movement
:
:If getKey(4)
:Vertical +
:O+1→O
:If O>>3
:J-1→J
:O-4→O
:For(A,0,23
:A*4-N→S
:0-O→T
:J*24+I+A→E
:sub(DRW
:End
:End
:End
:
:If getKey(1)
:Vertical -
:O-1→O
:If O<<1
:J+1→J
:O+4→O
:For(A,0,23
:A*4-N→S
:64-O→T
:J*24+I+A+360→E
:sub(DRW
:End
:End
:End
:
:End
:
:If getKey(2) xor (getKey(3))
:.horiz movement
:If getKey(2)
:Horizontal +
:N+1→N
:If N>>3
:N-4→N
:I-1→I
:For(A,0,15
:0-N→S
:A*4-O→T
:J*24+I+(A*24)→E
:sub(DRW
:End
:End
:End
:If getKey(3)
:Horizontal -
:N-1→N
:If N<<1
:N+4→N
:I+1→I
:For(A,0,15
:96-N→S
:A*4-O→T
:J*24+I+(A+1*24)→E
:sub(DRW
:End
:End
:End
:
:
:
:End
:DispGraph
:End
:
:
:Lbl DRW
:Pt-On(S,T,Pic0N
:Pt-Change(S,T,Pic0N
:.pt-on stuff
:!If {L1+E}-1
:Pt-On(S,T,Pic0N
:Else!If {L1+E}-2
:Pt-On(S,T,Pic1J
:Else!If {L1+E}-3
:Pt-On(S,T,Pic1S
:Else!If {L1+E}-4
:Pt-On(S,T,Pic1F
:Else!If {L1+E}-5
:Pt-On(S,T,Pic1R
:Else!If {L1+E}-6
:Pt-On(S,T,Pic1D
:Else!If {L1+E}-7
:Pt-On(S,T,Pic1W
:End
:.Return
« Last Edit: February 15, 2011, 11:14:28 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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: Tio
« Reply #247 on: February 16, 2011, 12:04:52 am »
It might be good to ask in another thread too, in case people won't see this one.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Tio
« Reply #248 on: February 16, 2011, 12:15:03 am »
Hm...looks like you're drawing the tileset but with an offset that makes it look glitchy. I'll take a look at it if I have time.
In-progress: Graviter (...)

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #249 on: February 16, 2011, 12:12:48 pm »
I have a feeling that adding amoothscrolling is going to take a while, so I'll post what I have now.

Added:
Level select.  Levels 00-99.
Different method of selecting tiles: move the cursor to the desired block and press ALPHA (the old menu is still available at MATH)
Format fixer: to change the old format (tio5 to tio2) to the new one
STIO6E is now a library program so it won't show up in the axe list anymore

Screenies in the next post.  I'm suspecting this proxy is why I can't have more than three attachments...

EDIT @Scout you were asking about disabling the overwriting.  Scroll through STIO6E, follow directions (just after If getKey(54)) and voíla, overwriting is disabled.
« Last Edit: February 20, 2011, 01:04:00 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #250 on: February 16, 2011, 12:14:06 pm »
Screenies.

okay..I attach 3 screenies, and only two show up...
ofc it works as soon as I say that :P
« Last Edit: February 16, 2011, 03:36:36 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Tio
« Reply #251 on: February 16, 2011, 01:04:12 pm »
Darl, I think I fixed the smoothscrolling problems! I got it working right literally 4 minutes after you left last night. Here are the things I modified, and I tried my very best not to optimize anything:
  • Adjusted the placement of the If statements inside shifting code
  • Changed the offsets to range from ⁻3 to 0 instead of 0 to 3, and then changed the drawing code to add the offsets instead of subtract them
  • Increased the maximum bound of the For() loops that draw new tiles by 1
  • Changed the occurrence of +360 to +384

With any luck those changes should make it work! I have put a side-by-side comparison of your code and the changed code below so it hopefully shouldn't be too difficult to track the changes I made.

Code: (Original code) [Select]
:.DTILEMPR
:[F0F0F0F000000000]→Pic0N
:[A0A0505000000000]→Pic1J
:[6040206000000000]→Pic1S
:[6040604000000000]→Pic1F
:[9000009000000000]→Pic1R
:[A050A05000000000]→Pic1D
:[000C030000000000]→Pic1W
:DiagnosticOff
:"vTIOLVL"→Str1
:GetCalc(Str1)→P
:Return!If P
:conj(P,L1,384
:0→N→O→I→J-1→E
:.I and J are coordinates of top left corner
:.N and O are tile offsets
:
:ClrDraw
:.draw init image
:For(Y,0,15
:Y*4→T
:For(X,0,23
:X*4→S
:E+1→E
:sub(DRW
:End
:End
:DispGraph
:Repeat getKey(15)
:Repeat getKey(0):End
:If getKey(54)
:ClrHome
:.display stuff
:Disp "random info",i,"I",I►Dec," J",J►Dec,i,"N",N►Dec," O",O►Dec
:While getKey(54):Pause 10:End
:End
:
:If getKey(1) xor (getKey(4))
:.vert movement
:
:If getKey(4)
:Vertical +
:O+1→O
:If O>>3
:J-1→J
:O-4→O
:For(A,0,23
:A*4-N→S
:0-O→T
:J*24+I+A→E
:sub(DRW
:End
:End
:End
:
:If getKey(1)
:Vertical -
:O-1→O
:If O<<1
:J+1→J
:O+4→O
:For(A,0,23
:A*4-N→S
:64-O→T
:J*24+I+A+360→E
:sub(DRW
:End
:End
:End
:
:End
:
:If getKey(2) xor (getKey(3))
:.horiz movement
:If getKey(2)
:Horizontal +
:N+1→N
:If N>>3
:N-4→N
:I-1→I
:For(A,0,15
:0-N→S
:A*4-O→T
:J*24+I+(A*24)→E
:sub(DRW
:End
:End
:End
:If getKey(3)
:Horizontal -
:N-1→N
:If N<<1
:N+4→N
:I+1→I
:For(A,0,15
:96-N→S
:A*4-O→T
:J*24+I+(A+1*24)→E
:sub(DRW
:End
:End
:End
:
:
:
:End
:DispGraph
:End
:
:
:Lbl DRW
:Pt-On(S,T,Pic0N
:Pt-Change(S,T,Pic0N
:.pt-on stuff
:!If {L1+E}-1
:Pt-On(S,T,Pic0N
:Else!If {L1+E}-2
:Pt-On(S,T,Pic1J
:Else!If {L1+E}-3
:Pt-On(S,T,Pic1S
:Else!If {L1+E}-4
:Pt-On(S,T,Pic1F
:Else!If {L1+E}-5
:Pt-On(S,T,Pic1R
:Else!If {L1+E}-6
:Pt-On(S,T,Pic1D
:Else!If {L1+E}-7
:Pt-On(S,T,Pic1W
:End
:.Return
Code: (Modified code) [Select]
:.DTILEMPR
:[F0F0F0F000000000]→Pic0N
:[A0A0505000000000]→Pic1J
:[6040206000000000]→Pic1S
:[6040604000000000]→Pic1F
:[9000009000000000]→Pic1R
:[A050A05000000000]→Pic1D
:[000C030000000000]→Pic1W
:DiagnosticOff
:"vTIOLVL"→Str1
:GetCalc(Str1)→P
:Return!If P
:conj(P,L1,384
:0→N→O→I→J-1→E
:.I and J are coordinates of top left corner
:.N and O are tile offsets
:
:ClrDraw
:.draw init image
:For(Y,0,15
:Y*4→T
:For(X,0,23
:X*4→S
:E+1→E
:sub(DRW
:End
:End
:DispGraph
:Repeat getKey(15)
:Repeat getKey(0):End
:If getKey(54)
:ClrHome
:.display stuff
:Disp "random info",i,"I",I►Dec," J",J►Dec,i,"N",N►Dec," O",O►Dec
:While getKey(54):Pause 10:End
:End
:
:If getKey(1) xor (getKey(4))
:.vert movement
:
:If getKey(4)
:Vertical +
:O+1→O
:If O>>0
:J-1→J
:O-4→O
:End
:For(A,0,24
:A*4+N→S
:O→T
:J*24+I+A→E
:sub(DRW
:End
:End
:
:If getKey(1)
:Vertical -
:O-1→O
:For(A,0,24
:A*4+N→S
:64+O→T
:J*24+I+A+384→E
:sub(DRW
:End
:If O<<⁻3
:J+1→J
:O+4→O
:End
:End
:
:End
:
:If getKey(2) xor (getKey(3))
:.horiz movement
:If getKey(2)
:Horizontal +
:N+1→N
:If N>>0
:N-4→N
:I-1→I
:End
:For(A,0,16
:N→S
:A*4+O→T
:J*24+I+(A*24)→E
:sub(DRW
:End
:End
:If getKey(3)
:Horizontal -
:N-1→N
:For(A,0,16
:96+N→S
:A*4+O→T
:J*24+I+(A+1*24)→E
:sub(DRW
:End
:If N<<⁻3
:N+4→N
:I+1→I
:End
:End
:
:
:
:End
:DispGraph
:End
:
:
:Lbl DRW
:Pt-On(S,T,Pic0N
:Pt-Change(S,T,Pic0N
:.pt-on stuff
:!If {L1+E}-1
:Pt-On(S,T,Pic0N
:Else!If {L1+E}-2
:Pt-On(S,T,Pic1J
:Else!If {L1+E}-3
:Pt-On(S,T,Pic1S
:Else!If {L1+E}-4
:Pt-On(S,T,Pic1F
:Else!If {L1+E}-5
:Pt-On(S,T,Pic1R
:Else!If {L1+E}-6
:Pt-On(S,T,Pic1D
:Else!If {L1+E}-7
:Pt-On(S,T,Pic1W
:End
:.Return


I tried my best not to optimize anything to keep it understandable. But if you want me to try optimizing it, just tell me. :P

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #252 on: February 16, 2011, 03:27:19 pm »
Awesomeness, it works!!! :w00t:  ;D  :hyper:
Thanks ;D
Now I just need to come up with a way to do this in the editor, and prolly by v8 or so there will be scrolling fully implemented!

EDIT: ok, apparently post rating doesn't work in this proxy...:P
« Last Edit: February 16, 2011, 03:28:48 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Tio
« Reply #253 on: February 17, 2011, 01:20:54 am »
Okay, I'm going to need some input.  What should the size options be for the levels, or should they be able to be defined at custom?
I'm kind of leaning towards 32*32 atm, but I'd like to hear other peoples' opinions.
Thanks in advance :)
Vy'o'us pleorsdti thl'e gjaemue

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Tio
« Reply #254 on: February 17, 2011, 10:22:46 am »
Awesomeness, it works!!! :w00t:  ;D  :hyper:
Thanks ;D
Now I just need to come up with a way to do this in the editor, and prolly by v8 or so there will be scrolling fully implemented!

EDIT: ok, apparently post rating doesn't work in this proxy...:P

Ohh In the Editor.... That seems tricky. Good Luck ;D