Author Topic: Axe Q&A  (Read 536582 times)

0 Members and 2 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #330 on: May 19, 2011, 03:36:57 pm »
The problem is if I keep pressing <UP> the pixel will go up and pass the vertical line.

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: Axe Q&A
« Reply #331 on: May 19, 2011, 03:51:13 pm »
I seriously don't get this, in most of my programs I use X+2->X and sometimes even 3. In order to avoid skipping vertical lines I usually check if (X<88) and (X<87) and stuff like that.

Either way, I am using Axe 0.5.2, but perhaps it was not the program's problem, I shall try again.

Since everything's inflated by 256 times now, you have to inflate those numbers too. Instead of X+2→X, you use X+512→X. Instead of (X<88) and (X<87), you use (X<22528) and (X<22272).




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #332 on: May 19, 2011, 04:18:04 pm »
Yeah I know Deep thought, but the pixel can still leave the screen :S

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #333 on: May 19, 2011, 04:20:37 pm »
Notice how in your code, it goes like this:

Keypresses
Move Object
Check for collision

What this means is that if you press a key, it *Will* move the object, because it's only after you move the object that you check to see if it should be stopping.  Move the collision test before the movement and it should work

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #334 on: May 19, 2011, 04:52:26 pm »
My current code is the following and the pixel doesn't really stop when hits the line:

Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

  X+A→X
  Y+B→Y
 
  DispGraph
End

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #335 on: May 19, 2011, 05:00:26 pm »
Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Axe Q&A
« Reply #336 on: May 19, 2011, 05:00:55 pm »
There's not code for stopping.

try this:
Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

<add this>
  If (pxl-Test(X/256,Y/256+1))
    0->B
  End
</add this>


  X+A→X
  Y+B→Y
 
  DispGraph
End

Also, you should put a terminal velocity in, such as B can't be greater than 256.  ;)


Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B

actually, that's his fall code.  ;)   note the "!"
« Last Edit: May 19, 2011, 05:01:59 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #337 on: May 19, 2011, 05:06:21 pm »
Oooh gotcha, that makes more sense ^^

Offline collechess

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +22/-2
    • View Profile
Re: Axe Q&A
« Reply #338 on: May 19, 2011, 05:14:16 pm »
How many bytes is an 8x8 monochrome sprite?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #339 on: May 19, 2011, 05:15:35 pm »
How many bytes is an 8x8 monochrome sprite?

8 bytes exactly.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #340 on: May 19, 2011, 05:15:57 pm »
8 bytes :) each pixel is 1 bit, and 8x8 is 64 pixels total, and 8 bits per byte, so 64pixels divided by 8pixels per byte equals 8 bytes ^^

EDIT: With simpler explanation :P

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #341 on: May 19, 2011, 06:45:24 pm »
There's not code for stopping.

try this:
Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

<add this>
  If (pxl-Test(X/256,Y/256+1))
    0->B
  End
</add this>


  X+A→X
  Y+B→Y
 
  DispGraph
End

Also, you should put a terminal velocity in, such as B can't be greater than 256.  ;)


Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B

actually, that's his fall code.  ;)   note the "!"

That worked, how stupid of me! The only problem is I can't jump since 0→A if I'm on the line. This I don't know how to change :S

Offline collechess

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +22/-2
    • View Profile
Re: Axe Q&A
« Reply #342 on: May 19, 2011, 06:53:13 pm »
How many bytes is an 8*12 tilemap?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Q&A
« Reply #343 on: May 19, 2011, 07:12:23 pm »
96 bytes?

Depends on how many bytes each tile is, I think.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Ashbad

  • Guest
Re: Axe Q&A
« Reply #344 on: May 19, 2011, 08:25:49 pm »
and if you compress it ;) if you have 16 or less different tiles, you can automagically cut that number in half by using nibbles (4 bit numbers).  In that case, a 8*12 tilemap goes down to only 48 bytes.  But it can get smaller with more compression techniques -- using RLE for example, with one nibble for the data and one for the length could even cut the size down below 20.  However, it can also be larger than 96 -- TaNF used 150-byte tilemaps, because each 'room' had more than just tiles, it also had things like enemy stats, objects, etc. So, it depends on what you're cramming in the space.