• Axe Q&A 5 5
Currently:  

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

0 Members and 5 Guests are viewing this topic.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #405 on: May 26, 2011, 05:03:20 pm »
Touching? Or overlapping? Here's overlapping:
Code: [Select]
If (X-Z+3≤6) and (Y-θ+3≤6)
  .Sprites are overlapping
End

And here's touching:
Code: [Select]
If (X-Z+4≤8) and (Y-θ+4≤8)
  .Sprites are touching
End

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #406 on: May 26, 2011, 06:38:51 pm »
Is
For(Q,0,65535
An infinite loop?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #407 on: May 26, 2011, 06:40:23 pm »
Yes, an infinite loop. The check in a For() loop consists of checking if the variable's value is greater than the upper bound. However, because a 16-bit number can never be greater than 65535, the condition will never be met and the loop will never end.

EDIT: If you need a loop with those bounds, use this instead. It's smaller, faster, and stronger too! (Well, maybe not stronger)

Code: [Select]
0
While 1
  →Q

  ;Put your code here

End!If Q+1
« Last Edit: May 26, 2011, 06:44:47 pm by Runer112 »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #408 on: May 26, 2011, 06:43:48 pm »
Thought so. Just wanted to make sure.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #409 on: May 27, 2011, 02:54:18 am »
And here's touching:
Code: [Select]
If (X-Z+4≤8) and (Y-θ+4≤8)
  .Sprites are touching
End

I'm interested in this code, what would the variables mean? Only one of the object moves (coordinates X and Y) and the other object is stopped (C for it's x position, E for it's y position), but this is in my code.

I guess X=X, Y=Y and Z=E and θ=C?

Thanks

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #410 on: May 27, 2011, 08:51:32 am »
Almost. Z is x and θ is y. Note how I paired the two x coordinates and the two y coordinates together in the If statement.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #411 on: May 27, 2011, 09:16:50 am »
I didn't get it :(

I have a sprite at the coordinates (C,E). That sprite is still.
I have a sprite that moves and I need to check if the moving sprite touches the other sprite, the moving sprite's coordinates are (X,Y).

I tried this:

Code: [Select]
If (X-C+4<=8) and (Y-E+4<=8)
  Return
End

It didn't work though :(

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #412 on: May 27, 2011, 09:26:27 am »
I whipped up a quick program and it worked for me. Are you sure you typed in the code correctly? And what is the context of where you added this code?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #413 on: May 27, 2011, 09:29:19 am »
The context is:

Code: [Select]
24→C
24→E
Repeat getKey(15)
If (X-C+4<=8) and (Y-E+4<=8)
  Return
End

.MORE COLLISIONS

.GETKEYS FOR THE MAIN SPRITE

.DRAW FLAG
Pt-On(C,E,Pic1)

.THE MAIN SPRITE
Rect(X/256,Y/256,4,4)

.DISPLAY IT ALL
DispGraph
End

So the main sprite moves with the keys, I want it when I touch the Pic1 (at coordinates (C,E)) the program closes.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Q&A
« Reply #414 on: May 27, 2011, 09:30:52 am »
I see your problem, it's that your X and Y are scaled by 256 while your C and E are not, so you can't just compare them normally. You should probably scale down the X and Y in the collisions.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #415 on: May 27, 2011, 09:38:56 am »
Woo! Thanks a lot calc84maniac and Runer112 :) I had to divide by 256 since it was in x256 mode.

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #416 on: May 27, 2011, 09:13:40 pm »
Is it ok to make an Appvar smaller by modifying the two size bytes? And are the size bytes of the same endianness of Axevars?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #417 on: May 27, 2011, 10:21:18 pm »
It is not safe to allocate/deallocate memory for an OS variable by just changing the size bytes. You'll probably want to use MemKit's Delete() function, which is able to deallocate a specified number of byte from an OS variable.
« Last Edit: May 27, 2011, 10:22:21 pm by Runer112 »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #418 on: May 27, 2011, 10:25:19 pm »
So I can't change the size bytes no matter what? Is there a specific reason?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #419 on: May 27, 2011, 10:30:59 pm »
When the variable was created, the OS allocated just the right amount of size to contain it. It uses that size to know how far after it in memory to store the next variable, and how much of memory to free up when the variable is deleted or archived. If you alter the number, it will result in either a memory leak or the variable overlapping another variable. The next time the OS tries to overwrite the variable, delete the variable, or rearrange the contents of RAM, there will likely either be a memory leak left in RAM or part of another variable will be overwritten.