Author Topic: Jumping  (Read 7929 times)

0 Members and 2 Guests are viewing this topic.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Jumping
« on: October 13, 2011, 06:54:44 pm »
I am looking for a tutorial on jumping, but one for a COMPLETE beginner.
I haven't been able to understand any so far.  :-\
If you could explain it or recommend a tutorial that would be great.  ;D

[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this:
Code: [Select]
:[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
:
but it doesn't store it or anything.
what is the use of this?
[/random question]
« Last Edit: October 13, 2011, 06:55:48 pm by parser padwan »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Jumping
« Reply #1 on: October 13, 2011, 06:57:34 pm »
I know this is written for TI Basic, but it is still very applicable to Axe code.  I highly recommend it.
http://www.omnimaga.org/index.php?action=articles;sa=view;article=37

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Jumping
« Reply #2 on: October 13, 2011, 06:58:56 pm »
* parser padwan reads the tutorial...
thanx ztrupet :D

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: Jumping
« Reply #3 on: October 13, 2011, 07:09:33 pm »
[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this:
Code: [Select]
:[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
but it doesn't store it or anything.
what is the use of this?
[/random question]
All static variables are stored one after another in memory, so if you do something like
Quote from: Axe
[00]GDB1
[FF]
then {GDB1+1} will be EFF.
« Last Edit: October 13, 2011, 07:21:38 pm by Deep Thought »




Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Jumping
« Reply #4 on: October 13, 2011, 07:12:02 pm »
[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this:
Code: [Select]
:[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
but it doesn't store it or anything.
what is the use of this?
[/random question]
All static variables are stored one after another in memory, so if you do something like
Quote from: Axe
[00]GDB1
[FF]
then {Str0+1} will be EFF.
ooh I think i get it now... XD

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Jumping
« Reply #5 on: October 13, 2011, 07:19:12 pm »
All static variables are stored one after another in memory, so if you do something like
Quote from: Axe
[00]GDB1
[FF]
then {Str0+1} will be EFF.
For the record, Deep made a typo here.  It should read:
...
Quote from: Axe
[00]GDB1
[FF]
then {GDB1+1} will be EFF.

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: Jumping
« Reply #6 on: October 13, 2011, 07:21:48 pm »
That, and the colors are wrong. Fixed.




Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Jumping
« Reply #7 on: October 20, 2011, 12:11:40 am »
Ok, so I have another question...
So, this was my first attempt at using pointers in axe.
I've got the Idea, but not completely, so I don't know what I did wrong with this program.
It's for a game I'm making called swords, and all that I need to do is have the enemies walk across the screen and back.
Source and Executable are included...
and screenie!!!
EDIT: I'll just put the source here:
Code: [Select]
:.ENEMY
:.enemy
:[3C4289819F423C14]->Pic1
:.X position of enemies in L1
:For(A,1,5)
:(A*9)->{L1+A}
:End
:.which direction each enemy is going
:For(A,6,10)
:1->{L1+A}
:End
:Repeat getKey(15)
:ClrDraw
:Line(0,63,95,63)
:Line(0,0,95,0)
:Line(95,0,95,63)
:Line 0,0,0,63)
:.draw guys
:For(E,1,5)
:Pt-On(({L1+E}),55,Pic1)
:End
:Dispgraph
:.see if at edge
:For(F,1,5)
:If ({L1+F}=1) or ({L1+F}=86)
:((-1)*({L1+F}))->{L1+F}
:End
: End
:.actually move them
:For(C,1,5)
:({L1+C})+({L1+(C+5)})->{L1+C}
:End
:Pause 50
:  End
« Last Edit: October 20, 2011, 01:01:52 pm by parser padwan »

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Jumping
« Reply #8 on: October 20, 2011, 01:35:29 pm »
After skimming your code which looks OK, I found four things:
- usually, you start arrays with the value zero, change that everywhere else.
- You have to use signed multiplication ( ** ) to multiply with a value less than zero.
- You are storing the direction value into the x-value, that won't work, so just add 5 to the pointer.
- If you use a version below 1.0.1 of axe, use the addition sign for conditions, not the 'or' keyword

Code: [Select]
:If ({L1+F}=1)+({L1+F}=86)
:-1**{L1+F+5}->{L1+F+5}
:End

To optimize a bit, use just one for loop for everything, than the speed will increase drastically.

Code: [Select]
:For(E,0,4)
:.from 0 to 4
:Pt-On(({L1+E}),55,Pic1)
:.see if at edge
:If ({L1+E}=1)+({L1+E}=86)
:-1**{L1+E+5}->{L1+E+5}
:End
:.actually move them
:{L1+E}+{L1+E+5}->{L1+E}
:End
:DispGraph

Hope that works

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Jumping
« Reply #9 on: October 20, 2011, 01:36:51 pm »
ooh yes it does. +1 XD
EDIT: but they just stop at the end, they don't reverse direction...
« Last Edit: October 20, 2011, 01:44:34 pm by parser padwan »

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Jumping
« Reply #10 on: October 20, 2011, 02:51:03 pm »
to optimize further, replace the parts where you use a for loop to set values with the Fill() command.

Example:

This:
Code: [Select]
:For(A,6,10)  // A = [6,7,8,9,10]
:1->{L1+A}  // {L1+6} = [1,1,1,1,1]
:End

could be this:

Code: [Select]
:Fill(L1+6,5,1)  // {L1+6} = 5*[1] = [1,1,1,1,1]


See?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Jumping
« Reply #11 on: October 20, 2011, 05:14:46 pm »
** Is fixed point multiplication, not signed multiplication.  The regular * multiplication works for both signed and unsigned numbers.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Jumping
« Reply #12 on: October 20, 2011, 06:42:31 pm »
** Is fixed point multiplication, not signed multiplication.  The regular * multiplication works for both signed and unsigned numbers.
hey yeah that was the error. thanx XD

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Jumping
« Reply #13 on: October 21, 2011, 12:55:23 am »
really, Quigibo? I could swear that in 0.5.3 it was signed.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Jumping
« Reply #14 on: October 21, 2011, 05:49:48 am »
It multiplies 2 signed fixed point numbers, the command has never changed since it was introduced.  The only time ** is used is when dealing with decimal numbers or inflated coordinate systems, which is why its in the advanced math category.
___Axe_Parser___
Today the calculator, tomorrow the world!