Author Topic: Problem with xLib.  (Read 5020 times)

0 Members and 1 Guest are viewing this topic.

CureDesu

  • Guest
Problem with xLib.
« on: January 21, 2007, 03:52:00 am »
Alright, I'm starting off to right my new game in xLib, but I'm having a problem when I move the character.  When he moves left, his right arm makes a continuous line, and it won't move up or down. (Note: I'm new to xLib).
Included here is a .rar with the program, the 2 pic files needed, and a screenshot. (The PTI .gif file).

user posted image


Thanks.

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Problem with xLib.
« Reply #1 on: January 21, 2007, 03:54:00 am »
hmm lemme take a look at it.  <_<dry.gif

EDIT: I like the .zip name  :Ptongue.gif

EDIT 2: Well, I got the dude to move up and down, but he still leaves lines  :(sad.gif
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

CureDesu

  • Guest
Problem with xLib.
« Reply #2 on: January 21, 2007, 04:06:00 am »
I tried redrawing the sprite, moving every pixel 1 pixel to the left. Now his left arm leaves a line.  It seems which pixel is the one the very edge, it leaves a line.  :???:confus.gif

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
Problem with xLib.
« Reply #3 on: January 21, 2007, 04:48:00 am »
could you post the source over here? so it should be easier for the non ti graph link user to help with code

CureDesu

  • Guest
Problem with xLib.
« Reply #4 on: January 21, 2007, 05:24:00 am »
Here's the source:

c1-->
CODE
ec1real(0
35->X:35->Y
[[0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [1,1,1,1,1,1,1,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1->[A]
real(2,0,0,0,12,8,0,12,7,8,2,0,8,1
Repeat 0
real(8
real(1,X,Y,1,8,1,0,0,0,0,1
If Ans:Then
X+(Ans=3)-(Ans=2)->X
Y+(Ans=1)-(Ans=4)->Y
End
Endc2
ec2

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Problem with xLib.
« Reply #5 on: January 21, 2007, 06:18:00 am »
are you sure xLIB getkey 1 = Basic getkey 34 and xLIB getkey 4 = Basic getkey 25?

EDIT:Haha man i just thought of the reason. You need to have the real(2,0,0,0,12,8,0,12,7,8,2,0,8,1
In the loop. I'm pretty sure that'll fix it.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

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
Problem with xLib.
« Reply #6 on: January 21, 2007, 06:35:00 am »
yeah now you are erasing the display with the map only before the loop start, you need to run it every time it loops

Offline Jon

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 278
  • Rating: +0/-0
    • View Profile
Problem with xLib.
« Reply #7 on: January 21, 2007, 06:56:00 am »
Cure, You could save some bytes w/ this:

c1-->
CODE
ec1
:{8,12} -> dim([A]
:Fill(0,[A]
:For(A,1,12
:1 -> [A](7,A)
:1 -> [A](8,A)
:End
c2
ec2

CureDesu

  • Guest
Problem with xLib.
« Reply #8 on: January 21, 2007, 07:17:00 am »
Jon: Thanks for the optimization.

I changed the code to this:
c1-->
CODE
ec1real(0
35->X:35->Y
[[0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0] [1,1,1,1,1,1,1,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1->[A]
real(2,0,0,0,12,8,0,12,7,8,2,0,8,1
Repeat 0
real(2,0,0,0,12,8,0,12,7,8,2,0,8,1
real(1,X,Y,1,8,1,0,0,0,0,1
real(8
If Ans:Then
X+(Ans=3)-(Ans=2)->X
Y+(Ans=1)-(Ans=4)->Y
End
Endc2
ec2

But, it still makes that line, and I can't move up and down.  :???:confus.gif

Delnar_Ersike

  • Guest
Problem with xLib.
« Reply #9 on: January 21, 2007, 10:44:00 am »
I've had some of these funny problems, too. Try to store the Ans variable into another variable right after the loop (like Z) and replace all the (Ans=...) with (Z=...). It might work, but I'm not sure, for I, too, am a beginner at xLib

CureDesu

  • Guest
Problem with xLib.
« Reply #10 on: January 21, 2007, 12:34:00 pm »
Delnar, I tried your suggestion.  It worked, in that I can now move in all directions, but my guy is still dragging a lot of lines.  Could it be because of the drawing logic?

Delnar_Ersike

  • Guest
Problem with xLib.
« Reply #11 on: January 21, 2007, 12:42:00 pm »
I think the problem there is that you are not erasing all of the sprite. I don't know how to fix that: I've never encountered that problem before.

The problem that was just fixed had to do with the:
X+(Ans=3)-(Ans=2)->X
Y+(Ans=1)-(Ans=4)->Y

The first (Ans=...) parts overrided the previous number in Ans, so the second part couldn't function correctly.

CureDesu

  • Guest
Problem with xLib.
« Reply #12 on: January 21, 2007, 01:08:00 pm »
Alright, thanks to xlibman's help, I got it working.  For those who want to know, here's what I do: I set it so if a key is pressed, the it displays the same sprite in the same spot with XOR logic, (without updating the LCD (same with the map)), then I update the coordinates and display the sprite in the new position.  Thanks for everyone's help.

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
Problem with xLib.
« Reply #13 on: January 21, 2007, 01:09:00 pm »
no problem :)smile.gif glad i could help

Delnar_Ersike

  • Guest
Problem with xLib.
« Reply #14 on: January 21, 2007, 01:41:00 pm »
Hope your game can be something we can enjoy! :Dbiggrin.gif