Author Topic: Bounce  (Read 11120 times)

0 Members and 1 Guest are viewing this topic.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #15 on: September 23, 2012, 10:39:45 am »
So... problems. Because of my roots as a BASIC proger, I've been optimizing as much as possible. The high score routine is embedded inside the game, but now I have to pull it out into a subroutine so the menu can call it.
So I used sourcecoder to cut/paste it into the bottom, and had it run a subroutine - just to test if it worked. When I tested it on Tilp2, the Highscore turned into a bunch of random mumbo-jumbo and the calc froze... I don't wanna test it on my own calc...
Here's the code:
Spoiler For Problem Code:
:.BOUNCE
:[003C7E7E7E7E3C00]→Pic1
:[106C4482446C1000]→Pic2
:"vBOUNCMP"→Str1
:"vBOUNCE"→Str2
:!If GetCalc(Str2)→H
:GetCalc(Str2,18)→H
:0→{H}{^r}
:conj("BLACKSCREEN  INC",H+2,16)
:End
:!If GetCalc(Str1)→M
:GetCalc(Str1,48)→M
:DeltaList(10,11,10,21,10,31,10,41,20,11,20,21,20,31,20,41,30,11,30,21,30,31,30,41,40,11,40,21,40,31,40,41,50,11,50,21,50,31,50,41,60,11,60,21,60,31,60,41)→GDB1
:conj(GDB1,M,64)
:End
:DiagnosticOff
:ClrDraw{^r}{^r}
:For(A,0,23)
:{2*A+M}→X
:{2*A+1+M}→Y
:Pxl-On(X,Y){^r}
:Pt-On(X-3,Y-3,Pic2){^r}
:End
:375→T
:37→X→B
:53→Y
:5→D→C→F
:0→E→S→I→J→G
:ref(0,0,5,60)
:ref(70,0,5,60)
:Fix 5
:Repeat (Y≥56) or getKey(15) or (G=1)
:If T≠0
:T--
:End
:Pt-On(X,Y,Pic1)
:ref(B-8,60,16,2)
:Text(76,0,"Score")
:Text(76,6,S►Dec)
:rref(76,12,8,50){^r}
:ref(76,62-(T*2/15),8,T*2/15){^r}
:DispGraph{^r}
:1→G
:For(I,0,23)
:{2*I+M}→K
:{2*I+1+M}→L
:If pxl-Test(K,L){^r}
:0→G
:If pxl-Test(K,L)
:S+F→S
:F+10→F
:Pxl-Off(K,L){^r}
:Pt-Change(K-3,L-3,Pic2){^r}
:End
:End
:End
:Pt-Change(X,Y,Pic1)
:If (D>64) and pxl-Test(4+X,8+Y)
:C→D
:5→F
:4+X-B/2+E→E
:End
:If pxl-Test(X-1,Y+4) or pxl-Test(X+9,Y+4)
:0-E→E
:End
:X+E→X
:Y-D→Y
:D--
:rref(B-8,60,16,2)
:If getKey(14)
:sub(H)
:Return
:End
:If getKey(1)
:C--
:End
:If getKey(2)
:B-2→B
:End
:If getKey(3)
:B+2→B
:End
:If getKey(4)
:C++
:End
:C+10^5+5→C
:If B>66
:66→B
:End
:If B<9
:9→B
:End
:Pause 99
:End
:Fix 4
:If G=1
:S+T→S
:End
:ClrHome
:Disp "Score:",S►Dec
:If S>{H}{^r}
:S→{H}{^r}
:Output(0,2)
:Disp "New Highscore!",{i}
:0→A
:Disp "Type Your Name:"
:Output(0,4)
:"WRMH"→GDB5
:det(3)
:"VQLG"
:det(3)
:"ZUPKFC"
:det(1)
:" YTOJEB"
:det(2)
:"XSNIDA"
:"                "→GDB9
:Repeat B=54 and (A≠0
:getKey→B
:If B=56 and (A≠0
:A--
:Output(A,5,' '►Frac)
:Output(A,5)
:End
:If B=15
:0→A
:Output(0,5,GDB9)
:Output(0,5)
:End
:If A<16
:If B>10 and (B<48)
:If {B+GDB5-11}→C
:Disp C►Frac
:C→{A+{L1}}
:A++
:End
:End
:End
:End
:0→{A+{L1}}
:conj({L1},H+2,16)
:End
:Return
:Lbl H
:ClrDraw{^r}{^r}
:Text(20,0,"High Score:")
:Text(5,8,H+2)
:Text(80,8,{H}{^r}►Dec)
:DispGraph
:Return
A few commands are weird; it's the BASIC version of them. I've also attached 2 files; BOUNCSRC is the original that works; BOUNCSRS (1) is the funky one. Anyone know what's going on?

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Bounce
« Reply #16 on: September 23, 2012, 05:44:22 pm »
i haven't looked at the rest of your code yet to see if there might be any other problems, but one thing that has caused such issues for me in the past was the fact that sourcecoder turns the small v token axe uses to designate appvars into the actual lowercase letter. if the program you got out of sourcecoder is using

:"vBOUNCMP"→Str1
:"vBOUNCE"→Str2

then try editing those on the calculator and changing them back to the 2nd+8 token.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #17 on: September 23, 2012, 07:42:46 pm »
Yup, that's it. I changed it, and it works now!
That's pretty bad, though; I'm going to have to do that whenever I use sourcecoder. I'm either going to have to do this on calc, or switch to my Windoze partition to use Tokens/BexIDE...
And this problem has consumed my weekend; I'll have to wait for the next weekend to keep working.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Bounce
« Reply #18 on: September 24, 2012, 08:59:01 pm »
tokens runs just fine under mono, so there's no reason you have to boot into wondows.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #19 on: September 24, 2012, 09:18:03 pm »
Really? Thanks, I'll try it!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #20 on: September 28, 2012, 11:27:45 pm »
I've managed to get the menu working, and I've reorganized my code so it works.

New features:
Spoiler For Features:
Menu - Highscores, Play and Quit are working; About will be added in shortly. Choosing About will just reset the Menu.
*Also, I seem to have neglected to give you the controls. They'll come shortly.
Changed ball sprite to a square, like the original game. Unfortunately, as wall-breaking isn't fixed, this causes some problems sometimes.
Did some things to try and stop wall-breaking. Failed.
Ball now starts in center of paddle, so you don't have to act the instant it starts.
Now, for the Controls:
Spoiler For Controls:
Left to move the paddle Left; Right to move the paddle Right.
The ball will move with the paddle in the menu, but not in-game. It will bounce 'away' from the paddle if it doesn't hit the center of the paddle.
Up/Down to change the ball's height. Height scrolls in-game, but on in the menu.
Clear to quit. In the menu, it exits; in-game, it acts as if you lost.
To select an item, move the ball under the choice and change the height so it hits the letters.
You can also hit [2nd] to instantly select.
When text is on the screen, hit [2nd] to continue.
To Do:
Spoiler For To Do:
Fix Bugs (see below)
Add the About choice.
Fix the logo.
More on the level editor
Add slowmo and pause features (there's more, but that's all for now)
I've also got a lot of glitches that I can't seem to fix.
If you know Axe, please go to page one and download my source! I need help fixing these bugs... Any help would be appreciated!

Bugs:
Spoiler For Bugs:
Sometimes the ball goes through the wall, and if it goes far enough, will bounce from it, messing it up completely. I added:

:If X>70
:70→X
:End
:If X<1
:1→X
:End

but it still goes through the wall sometimes! (Although not as often as before.) I don't understand!

Sometimes the ball will start flashing, skipping. It's hard to explain, but if you play it a few times, you'll see it. When it does this, there's no way to catch it - you'll lose when it comes down, even if your paddles located perfectly. idk why this happens and how to fix this.

The gray scale timer leaves behind residue as it moves down. I have no idea what's happening here.

I think that's all the bugs! Please help fix this if you can!

And that's all! As a final note, don't hold down [2nd] to progress. Tap it. Otherwise, it'll detect another [2nd] and you'll play the game again rather than going back to the menu. I'll try to fix that soon.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Bounce
« Reply #21 on: September 29, 2012, 03:07:41 am »
Looks pretty cool! And to the going off side, make sure that your if-conditions are directly after recalculating the position of the ball.
And to your 2nd problem - just use a different key in one case XD

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #22 on: September 29, 2012, 11:28:19 am »
Yeah, that seemed to be the problem. I had the safeguards set before I updated the variables. Just moved the code.
Unfortunately, after 5 test runs, it broke the wall. But it happens way less often now and it doesn't break the game.  :)

But I don't understand what this means:
And to your 2nd problem - just use a different key in one case XD
??? Please explain!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Bounce
« Reply #23 on: September 29, 2012, 12:50:25 pm »
you use for both thingies the 2nd key, so if you hold it to long it opens the game again. If you use for one thingy like alpha it wouldn't happen as that key doesn't have a function in the menu

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #24 on: September 29, 2012, 04:01:20 pm »
Oh, I see what you mean. But [2nd] is really the best choice...

OK. After some digging, I found ztrumpet's Jump! source. He solved it like this:
Code: [Select]
While getKey(54)
Pause 50
End
So the user has to let go of [2nd] before it does anything, fixing it! He's a genius.
Problem solved.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Bounce
« Reply #25 on: September 29, 2012, 04:38:37 pm »
Oh, nice idea :D But wouldn't it also work without the pause? ;)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Bounce
« Reply #26 on: September 29, 2012, 06:49:43 pm »
I tried:
Code: [Select]
:Repeat getKey(0)
:End
it didn't work. :(
But you can save a byte in the source by using
:Pause 9
rather than
:Pause 50
I just tried it; it works.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Bounce
« Reply #27 on: September 29, 2012, 06:56:48 pm »
Shouldn't it be:

Code: [Select]
While getKey(0)
End

or more optimized (I think)

Code: [Select]
While 1
EndIf getKey(0)

if you want the same functionality as zTrumpet's code?

A trick I like using to make sure the player doesn't hold the button, but at the same doesn't use the getKey→ function is to do this (using 2nd as an example)

Code: [Select]
If getKey(54)
If K
0→K
[code goes here]
End
Else
1→K
End

I'm sure there's more optimized ways to do it, but that's one of the easiest ways to understand how it works.
« Last Edit: September 29, 2012, 06:59:29 pm by leafy »
In-progress: Graviter (...)

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: Bounce
« Reply #28 on: September 29, 2012, 07:16:30 pm »
Oh, nice idea :D But wouldn't it also work without the pause? ;)
It doesn't for me. Pause 8 seems to be the smallest pause that allows the code to work correctly.
But you can save a byte in the source by using
Smaller source doesn't always mean smaller program. Sometimes it's actually larger :) (In this case it's the same size.)
« Last Edit: September 29, 2012, 07:16:46 pm by Deep Thought »




Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Bounce
« Reply #29 on: September 29, 2012, 08:16:45 pm »
Oh, nice idea :D But wouldn't it also work without the pause? ;)
It doesn't for me. Pause 8 seems to be the smallest pause that allows the code to work correctly.
why does it need pause?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!