Author Topic: Routines  (Read 317274 times)

0 Members and 3 Guests are viewing this topic.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Routines
« Reply #270 on: May 24, 2010, 11:21:37 am »
I'd have to agree with the others and say I like the gray over black one the best. Does the gray over black one animate faster, or is that just my imagination? O_o

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: Routines
« Reply #271 on: May 24, 2010, 12:35:56 pm »
thanks ^^

And no the two animates at the same speed

SirCmpwn

  • Guest
Re: Routines
« Reply #272 on: May 27, 2010, 10:20:06 am »
So, I got a simple routine to measure a piece of small text.  It works like this:
The height is always 5 pixels.  Easy enough.
The width is harder.  However, I found a quick and easy method of doing this:
Code: (Axe Basic) [Select]
Fix 3
Text(X,Y,Str1
X→Z
While pxl-Test(Z,Y
Z+1→Z
End
Z-X→Z
Fix 2
Text(X,Y,Str1

This returns the width in Z, and draws the text in Str1 to the graph screen.
« Last Edit: May 27, 2010, 10:31:07 am by Mr_Coding_Knight »

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: Routines
« Reply #273 on: May 27, 2010, 10:27:54 am »
This returns the height in Z, and draws the text in Str1 to the graph screen.
Do you mean it returns the width? :)

It sounds like a great routine.  Nice job! :D
« Last Edit: May 27, 2010, 10:28:10 am by ztrumpet »

SirCmpwn

  • Guest
Re: Routines
« Reply #274 on: May 27, 2010, 10:30:47 am »
*ahem* woops
Editing now...

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #275 on: May 27, 2010, 10:37:33 am »
Thats a ice way to do it :) I myself use a lookup table in my Ti Basic Editor though, i need speed ^^ Since its inverted it works for space too right?

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: Routines
« Reply #276 on: May 27, 2010, 10:44:45 am »
Since its inverted it works for space too right?
I'm pretty sure it does.  :)

SirCmpwn

  • Guest
Re: Routines
« Reply #277 on: May 27, 2010, 11:32:31 am »
Yes, it will work for space.  I noticed that the top row of pixels is always black on the inverted font, so it is easy to measure it.

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: Routines
« Reply #278 on: May 27, 2010, 02:20:10 pm »
interesting

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Gravity
« Reply #279 on: May 31, 2010, 01:36:26 pm »
I figured i would put this under routines since it might be useful for other people if someone can help me.

how would i implement gravity in axe? it doesn't have to be realistic, i just want to manage getting a sprite to jump up and down.
i could easily implement this with some flag variables, but i'm really looking for a routine that only uses a few variables. Even just a starting point or hint would be helpful. So far, i can get a sprite to jump up, but it won't come back down.


Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Routines
« Reply #280 on: May 31, 2010, 02:39:16 pm »
how would i implement gravity in axe? it doesn't have to be realistic, i just want to manage getting a sprite to jump up and down.
i could easily implement this with some flag variables, but i'm really looking for a routine that only uses a few variables. Even just a starting point or hint would be helpful. So far, i can get a sprite to jump up, but it won't come back down.
If you don't need realistic simulation simply reduce by some value (test for one that makes the desired effect) velocity in y coordinate each frame and that is it.
I think for gravity simulation you need at minimal 2 variables: Y position and velocity in Y coordinate.

Pseudo code:
Lbl A
// code
V-9->V
Y+V->Y
// code
Goto A
//Y has now the coordinate

Mind that V velocity will be negative, so when adding V to Y it will be actually subtracted.
« Last Edit: May 31, 2010, 02:42:07 pm by Galandros »
Hobbing in calculator projects.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #281 on: May 31, 2010, 02:40:24 pm »
This http://ourl.ca/4279 might be of some help to you :)

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Routines
« Reply #282 on: May 31, 2010, 04:14:29 pm »
finally managed to get it to work. if anyone wants to look at the code here it is (let me know of any optimizations i could make):
Code: [Select]
.AA
ClrDraw
[3C7EE7C3C3E77E3C->Pic1
0->V+55->Y
Line(0,63,95,63
While getKey!=15
If getKey(4) and (V=0) and pxl-Test(5,Y+8
5->V
End
If V
V-1->V
Y-1->Y
End
If Y>99
0->V->Y
End
Pt-Change(5,Y,Pic1
DispGraph
Pt-Change(5,Y,Pic1
If (V=0) and (0=pxl-Test(5,Y+8
Y+1->Y
End
Pause 15
End

EDIT: now trying to modify it so you can't jump in the air.
EDIT: code edited to make that possible.
« Last Edit: May 31, 2010, 08:28:51 pm by nemo »


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: Routines
« Reply #283 on: May 31, 2010, 11:55:50 pm »
glad to see you got it working ^^

It is possible to make the jump gravity more smooth in the way that you'll gradually move up slower and slower then gradually start falling, but that's a step further. Builderboy has a tutorial explaining that in the Axe Parser sub-forum somewhere.

I need to start messing around with tilemaps and the like x.x

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Routines
« Reply #284 on: June 01, 2010, 03:24:15 pm »
i actually managed to get that to work (finally got my head to wrap around bloating the y variable for precision). then i turned it into a simple game where you hop from platform to platform as the screen scrolls to the left and you try not to touch the ground.