Author Topic: DoodleJump Discussion  (Read 95101 times)

0 Members and 1 Guest are viewing this topic.

Offline Mohammad

  • Project Author
  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +23/-8
    • View Profile
DoodleJump Discussion
« on: December 09, 2010, 06:37:12 pm »
Current stable version: 1.0
last update: 9/11/2011

Featured power-ups  
Jetpack (Press 2nd to use. Used for reaching higher or preventing falling)
Spring Feet (Enables springed feet for 6 jumps)
+100 points (Gives 100 points)
SlowScroll (Makes doodler jump lower)
Arrow (Allows to jump higher)
Question Mark (provides random power-up)
Contrast Flip (Inverts colors on the screen)
Slow Motion (Slows the gameplay down for some time)


Developer
This game was developed by me, Mohammad Adib, when i was a freshmen in High School. Spending my time programming and messing around with my calculator in math class, I created this in order to challenge myself to take an idea and bring it to reality, which I (if i do say so myself) have successfully accomplished. This was my first programming experience, and i have since been learning more and more languages, and am wishing to pursue a carrier in Computer Science.

*Also: As far as i recall, the game also has sound effects which can be heard if headphones are plugged in.
__________________________________________________________________
Download Here: http://ourl.ca/9046
__________________________________________________________________
Gameplay:

I've also attached the source in a zip featuring a pdf with the code written out and the .8xp file and pictures in .8xi format.
*compiled with Axe 4.5 (newer ones not recommended for this game!)
« Last Edit: September 13, 2011, 01:04:17 am by Mohammad »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #1 on: December 09, 2010, 07:07:34 pm »
Hello!  Welcome to Omnimaga.

You shouldn't worry about people stealing your program.  If somebody does do that, then the community tends to get VERY angry at them (and shun them, and ban them, and dislike them in every way...  Of course, looking at other people's code, and sharing ideas are highly encouraged.  The calculator community tends to be very open-source).  Of course, accusations of theft are equally disliked, which got a few people in trouble a while back when they got too paranoid.

1) If you don't like the idea of having to store x and y coordinates into two vars, you could just use modulus to combine them into one.  If I do this:
335->A
Then I could extract the x-intercept by doing 335^255 (which is 335 mod 255, which returns 80) and the y-intercept by doing 335/255 (which returns 1, because there are no decimals in Axe.)
So basically, to store coordinates into one number, X-intercept+(255+Y-intercept)->variable.

2) To do sound, use the Freq( command.  I don't know the exact numbers, but try experimenting with Freq(1250,(add any multiple of 1250 here)).  This should get you a sound that is relatively low.  (Of course, you need 2.5mm headphones to listen to sound with the calc...)

3a)  First, you don't really need decimals at all.  If I wanted to use decimals, I could just multiply the number by 100 (or better yet, 255), manipulate it, then divide it by 100 (or whatever you're inflating it with) when displaying on the screen (because a 64x96 screen is pretty inaccurate to begin with)
That being said, I'm not entirely certain how I would make a project follow a parabolic path, but I would try adding gravity, simulating how much power is in the projectile, and simulate real life.  You should probably ask Builderboy.  He's good with physics.

3b) Inflate all the numbers (let's pick an inflation number of 255, because it's cool), use the standard y=mx+b slope formula, find out what the next number is, then divide by 255 (or the inflation number) again.  Then use Pt-On (or whatever similar command)

4) Number^2
If this returns 1, it's odd.  If it returns 0, it's even.  (or perhaps its the other way around, but you should be able to figure it out)

Edit: Apologies if I didn't make much sense, or made mistakes - I'm a bit sleepy.
« Last Edit: December 09, 2010, 07:08:49 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Mohammad

  • Project Author
  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +23/-8
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #2 on: December 09, 2010, 07:10:24 pm »
Thank you :)

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #3 on: December 09, 2010, 07:12:24 pm »
You're welcome :)
Let us know if you have any other questions!  Hope your project works out!
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Mohammad

  • Project Author
  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +23/-8
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #4 on: December 09, 2010, 07:15:44 pm »
so how does the example program from the axe app zip called AXESHIP have enemies shooting multiple bullets each? does he use a variable for each bullet...also how do i store stuff in lists obviously {1,2,3,4}->L1 will not work... im too lazy to decifer the code...who wrote it?
« Last Edit: December 09, 2010, 07:16:42 pm by Mohammad »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #5 on: December 09, 2010, 07:19:34 pm »
ive been working on doodlejump for the calculator for about a week now. i thought it would be a great idea and i did it and added sound...however its only halfway complete but already addictive and attractive...i think i've took it to a point where all that is missing is the monsters and shooting.btw..do not steal my idea to make doodlejump!
...
3a. How do i make a projectile follow a parabolic path (in Ti-Basic you can do Pt-On(34.56,x2+2x+C) but in axe its all integer numbers so i cant do Line(2.5,3.5,4.5,1/3...i think thats a major downfall...)
3b.How do i make a ball/bullet follow a linear path(line) that is at any angle...basically how can i make a pixel follow a linear equation?
4. major question here...this will solve problem 3 for me...wheres the precious int( command? how do i know if a number is even without going ":if A/2=int(A/2"? how can i do int(3.45x+3) in axe?


I think I saw a topic labeled DoodleJump around here recently...

Anyway, the main difference between Axe and BASIC is that there are no decimals in Axe. None at all [barring Assembly work]. The easiest way to have projectile motion is to forget about realistic numbers and realize that you're working on a pixelated screen. Thus, you can give objects vectors in the form of moving a certain number of pixels per frame. Thus, a ball with no horizontal motion might move 0 pixels left or right, but could drop a constant 3 pixels per frame or something.This also solves the linear path problem because all you would have to do is set the position change variables constant. If you want to get into acceleration, that's also possible, but it requires some additional steps.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #6 on: December 09, 2010, 07:23:48 pm »
to start, no one is stealing your idea to make doodlejump. to be frank, doodle jump has been at least partially ported in axe already. if i want to make a doodle jump clone, i will.
alright... many questions. i'll start with the first.
1. use some of the free RAM areas. use L1. so {L1} contains the first bullet's X pos, {L1+1} is the Y pos. {L1+2} is the second bullet's x pos, {L1+3} likewise.
2. you cannot. well, you *can*, but it's not really worth the trouble.
3a. this is the one i feel confident in explaining. when division occurs, the remainder is truncated. 1/3 produces 0. 5/6 produces 0. 7/6 makes 1. this is only a downfall if you plan on making a math program. in which case, you shouldn't be programming in axe, you should be programming in TI-Basic. i'll give a code snippet to make a black square jump up and down when you press [2nd]. horizontal movement i'll leave up to you. basically, you need a velocity variable and a position variable. you also need a number. we'll pick 16. the screen is 96 pixels wide and 64 tall. as you said, you can't display something at .5 of a pixel. so, we must enlarge the screen. if our screen were 192 pixels tall and 128 tall, we'd technically be able to place a sprite at twice the precision as if the screen was 96 by 64. therefore, our X and Y position variable is going to be twice as large right? why don't we just pretend? let's say the screen is 96*16 pixels wide, and 64*16 tall. then, everytime you add 1 to your X position, you are technically moving it by 1/16th of a pixel.
Code: [Select]
ClrDraw
[FFFFFFFFFFFFFFFF]->Pic1
Line(0->V,58,96,58)
800->Y
Repeat getKey(15)
If Y=800 and getKey(54) // if there's no velocity and you press [2nd]
20->V                      //increase that velocity.
End
If Y-V->Y<800                   //collision detection here
V-1->V
Else
0->V
End
Pt-Change(8,Y/16,Pic1)
DispGraph
Pt-Change(8,Y/16,Pic1)
End

question 3b will be answered once i recall my knowledge of the sin/cos routines.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #7 on: December 09, 2010, 07:26:05 pm »

question 3b will be answered once i recall my knowledge of the sin/cos routines.

Hint: They return a value between 0 and 255 and are normal otherwise.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #8 on: December 09, 2010, 07:28:33 pm »
don't forget the numbers are signed: -127 to 127. Also, if you want to use degrees, you will have to multiply all your angles by 32/45 before running them through the sin/cos routines because their period is 256 instead of 360
« Last Edit: December 09, 2010, 07:29:15 pm by squidgetx »

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #9 on: December 09, 2010, 07:28:55 pm »

question 3b will be answered once i recall my knowledge of the sin/cos routines.

Hint: They return a value between 0 and 255 and are normal otherwise.
no, they return a value between -127 to 127. and they are not normal otherwise. they have a period of 256, not 2pi.

also, i was thinking of the problem of making a routine which retains a constant speed while being able to change your direction. linear bullets are easy because you just have an x velocity and y velocity, like michael lee said.
« Last Edit: December 09, 2010, 07:30:19 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: Projectile motion, sound, doodlejump
« Reply #10 on: December 09, 2010, 07:39:23 pm »
Just one thing: I think people should be allowed to make what game they want, even if they had a similar idea as you. In fact, a DoodleJump game was started a few days ago by someone else here. It doesn't mean he have to stop working on it because you started one and it doesn't mean you have to stop working on yours because he started his before yours: you may get some different ideas than he did and offer different features or he might find some different ideas, or you or him could simply be programming a similar game for learning purposes. Also don't worry about people stealing other people code, they will get spotted quickly if they do, considering a lot of people here check the forums and ticalc.org.

Anyway good luck with your game and welcome on the forums. Just make sure to be respectful towards other forum members, regardless of their project ideas and also try to not be too quick on theft accusations. Someone else did that before here and it was not taken very well. It sounds very offensive to the people that try to legitimately contribute to the TI community.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #11 on: December 09, 2010, 08:35:50 pm »
To get lists in Axe, there are things called free ram and pointers. 

But first, I should go over how memory works in Axe, which you can skip over if you already know about bits and bytes.
At the very basic level, everything is ones and zeros.  This is binary.  Each one and each zero is referred to as a 'bit'
Axe uses something called bytes to manage memory.
A byte is comprised of exactly 8 bits.
So if 1 is a bit, and 0 is another bit, then 10110001 is exactly one byte.
One byte can hold numbers equal to 255 or under.
However, this often isn't big enough, so Axe allows you to use two bytes in a row to hold numbers up to 65535 (which is 256*256-1).
I like to imagine bytes as houses, all lined up in a row.  A bit is like a (tiny) room in that house, and two houses together can hold A LOT of people.
But we have to know where each house is, which is why they all have addresses.  We call those addresses pointers.

Which brings us nicely to free ram.
The symbol L1 is a address that points (hence the name pointer) to a 710-byte-long block of free RAM that you can use as you please.
By adding a number to the pointer, we can get access to other bytes besides the first one.
Also, by adding brackets around the pointer, we can then manipulate what number is actually stored in that byte instead of just manipulating the address.

So, L1+5 would get me the address fifth byte of free ram and {L1+5} would get me whatever number I've put there.
Examples:
Code: [Select]
.CODE1
1->{L1}
1->{L1+1}
2->{L1+2}
3->{L1+3}

For(A,0,3)
  Disp {L1+A}->DEC,i      //imaginary i for newline, here
End

Pause 5000  //added for completeness - now a functional program!
The For loop would display the numbers I had placed into free RAM earlier, displaying
1
1
2
3

To get two-byte numbers, I would just do something like {L1+A}r
The 'r' makes that pointer return the two-byte number (using the one following the pointer for the second byte)

L2 to L6 also return pointers to more free RAM, but you should check the commands list because the amount of available bytes varies, and L6, for example, is used by Axe to store what your program is displaying on the screen, so messing with the other 5 pointers besides L1 can have some inconvenient consequences.
« Last Edit: December 09, 2010, 10:34:25 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

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: Projectile motion, sound, doodlejump
« Reply #12 on: December 09, 2010, 08:47:23 pm »
Now, now...  Everybody calm down, let's not scare the new member...
People can make whatever they want, so long as they don't get nasty about it
I know, I wasn't trying to scare him away, I was just making sure he knows we're not here to steal his ideas/work.
Quote
, and beginners are allowed to start with some worries...
Not if it goes against the forum rules. In that case rules are applied the same way they would with any other member.
« Last Edit: December 09, 2010, 08:57:55 pm by DJ Omnimaga »

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #13 on: December 09, 2010, 10:04:44 pm »
lol, a lot of Doodle/Papi Jump ports lately  XD
but anyway, good luck, can we haz screenies soon?  :D

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Mohammad

  • Project Author
  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +23/-8
    • View Profile
Re: Projectile motion, sound, doodlejump
« Reply #14 on: December 10, 2010, 01:07:57 am »
 :) im very sorry i didnt mean to harm anyone (i removed the accusation part). just here to improve my axing abilities :)