Author Topic: My little program  (Read 11065 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
My little program
« on: July 27, 2011, 11:11:26 am »
I've made a little program in Axe language. (axe 1.0.2)
I've tried to make a program, where you (a ball) can walk on courved lines, and needed a bit more than two hours for it.

But the ball is standing in the air if the Y-coord is 14.
So I added
:if Y=14
:if getkey(2)+getkey(3)=0
:Y+1->Y
:End
:End

But why is the ball stopping there?



It's NOT a finished game.
*insert supercool signature*

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: My little program
« Reply #1 on: July 27, 2011, 02:20:16 pm »
I tried it, it's funny, good for a first program. I'd like to say though the performance would be boosted if it weren't for the grey shadows, they're unnecessary and only make the game slow. When I and DJ thought you how to make it, I told you the For loop was a slow idea, I recommend removing it.

Concerning the physics, it's really good for someone who is new to Axe. Nice job!!!
« Last Edit: July 27, 2011, 02:20:24 pm by ephan »

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: My little program
« Reply #2 on: July 27, 2011, 04:40:17 pm »
Although I couldn't figure out your problem, I did speed it up a lot by moving/deleting a few lines (mainly excess ClrDraw and DispGraph) and deleting the greyscale.  Good job overall, and although I haven't worked with Axe much, it looks like a solid start to a game :thumbsup:

Here's my modifications, I only really made small changes.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: My little program
« Reply #3 on: July 27, 2011, 06:13:26 pm »
Why don't you try this?

If Y=14
!If getkey(2) or (getkey(3)
Y+1->Y
End
End

Always, always, always remember Axe's order of operations - left to right.

So in Axe, 3+4*2 would return 14, but in school you are taught that the answer would be eleven. It takes some getting used to, but can used very much to your advantage.
« Last Edit: July 27, 2011, 06:14:37 pm by buttsfredkin »
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: My little program
« Reply #4 on: July 28, 2011, 12:23:49 pm »
ephan:
I'll remove the grayscales and make them new.
I'm working on my plan, that the Ball will be changed to a line, which will always rotate so that it's 90° from the platform, even if it's walking in a circle (not calculatet, only inserting the correct picture of the line)



chattahippie:
If you want to see the problem, remove the
Code: [Select]
:.FIX BUG
: If Y=13
:  If getKey(2)+getKey(3)=0
:   Y+1->Y
:  End
: End
Then you'll see it.


buttsfredkin:
Thanx, I did not know that Axe is reading from left to right.
I'll change it.




Should I try to make a real game of it?
*insert supercool signature*

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: My little program
« Reply #5 on: July 29, 2011, 12:23:42 am »
Yeah, I meant I couldn't see why it glitched out.  Sorry for the bad wording.

You should totally make this into a game! Just remember, you only need one DispGraph and ClrHome, preferably DispGraphrClrHome.
It's much faster this way, since you aren't updating the screen after everything you do, plus DispGraphr is much faster than DispGraph, last I heard.

I've taken out greyscale, and moved your constants to a better place, as well as fixed the DispGraph problem in the attachment in my last post.  It's much faster now.  Feel free to look at/use those for examples.  As I'm still a beginner too, I'm sure my modifications to your programs are still slower than they could be, but it was as best as I could do. :P 

Good luck and keep us (me) posted on how this ends up!  ;D

By the way, why do you store .5 to M?  Axe doesn't support decimals.  That might be where the "Y=13" problem is.
« Last Edit: July 29, 2011, 12:33:24 am by chattahippie »

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: My little program
« Reply #6 on: July 29, 2011, 05:52:03 am »
Yes, that may be the problem.

I've planned that the ball can move faster hotizontal, if he's standing, than if he's falling.
But I've deleted that.
I've had:
Code: [Select]
X-M*getKey(2)+M*getKey(3) -> XBut of cause it hasn't worked, so I deleted it.

You may make it faster if you remove the part where it saves something as M and change in the whole code, that it should check A, and not M.
(A is defined by the large block of pxlTest( at the top of the code)
*insert supercool signature*

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: My little program
« Reply #7 on: July 29, 2011, 05:55:56 am »
Code: [Select]
X-M*getKey(2)+M*getKey(3) -> X
That won't work. You're forgetting about the left-to-right order of operations.
Code: [Select]
M*getKey(3)-(M*getKey(2))+X->X
« Last Edit: July 29, 2011, 05:56:19 am by ZippyDee »
There's something about Tuesday...


Pushpins 'n' stuff...


Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: My little program
« Reply #8 on: July 29, 2011, 05:57:55 am »
In the code it works:
Code: [Select]
X-getKey(2)+getKey(3) -> X
Yeah, I'm right!  ;D
*insert supercool signature*

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: My little program
« Reply #9 on: July 29, 2011, 05:58:02 am »
Even better, getKey(3)-getKey(2)*M+X->X :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: My little program
« Reply #10 on: July 29, 2011, 05:59:27 am »
Oh, yeah...Of course!
* ZippyDee facepalms for not thinking of that...
There's something about Tuesday...


Pushpins 'n' stuff...


Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: My little program
« Reply #11 on: July 29, 2011, 06:00:09 am »
I don't use the M.
It was if I wanted the ball moving horizontal slower while falling than while standing (So that it's more realistic)

But I think that would be possible, too.
*insert supercool signature*

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: My little program
« Reply #12 on: July 29, 2011, 11:26:27 am »
You should totally make this into a game! Just remember, you only need one DispGraph and ClrHome, preferably DispGraphrClrHome.
Unless you need the speed of DispGraphClrHome , I wouldn't use it.  It makes your code larger, and unless speed is of the utmost importance, I'd go with DispGraph : ClrHome .  Good luck! :)

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: My little program
« Reply #13 on: July 29, 2011, 11:47:30 am »
Yesterday, Ive written the complete code new, with a line with a lenth of 5 as object.
It was really not bad, but the line was a bit too small.

When I saved my progress in a group, it was a RAMCLEAR!
 (while saving progress  :banghead:)

Now, I'll write it all again.
*insert supercool signature*

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: My little program
« Reply #14 on: July 29, 2011, 02:06:37 pm »
:(

That's happened to me quite a few times too.  Archive the source before you parse it, so ram clears don't delete it.  And of course, I am required to say that you need to back it up to your computer to almost ensure no data loss, even if a full mem reset occurs