Author Topic: Gravity Jump  (Read 12253 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Gravity Jump
« on: February 29, 2012, 09:52:38 pm »
I am posting this because I figure it might be useful for anybody who wants to design a platformer in Grammer code. It also might serve as a decent example for pseudocode for others writing a similar engine *cough*

It features collision detection, grayscale, and gravity. For this example, use Enter to jump and left/right to move. Press clear to exit :) It draws a border, but otherwise leaves the screen untouched for your own obstacles.
Code: [Select]
:.0:
:13→G'
:π9872→W
:Disp oW
:0→B→A
:64→X→Y
:Line(0,0,64,96,3
:Repeat getKey(15
:Y/64→F
:X/64→E
:Line(E,F,5,5,6
:Line(E+1,F+1,3,3,1,W
:DispGraph
:Line(E,F,5,5,4
:Line(E+1,F+1,3,3,0,W
:pxl-Test('E,F+5,1,5,0→C
:If *B=abs(B
:0→A→B
:Y→Z
:If !C:+B≠abs(B
:B+G'→B+Y→Z
:If B
:Then
:If B≠abs(B:*pxl-Test('E,F-1,1,5,0
:0→B
:If B=abs(B
:Then
:Z/64→D
:While D≠F
:F+1→F
:If pxl-Test('E,F+5,1,5,0
:F→D*64→Z
:End
:End
:Z→Y
:End
:If C*getKey(9
:‾63→B
:getKey(3
:-getKey(2→H*64
:→I+X
:/64
:E+2+H*3→H
:For(G,F,F+4
:If pxl-Test(G,H
:0→I
:End
:X+I→X
:End
:Stop

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Gravity Jump
« Reply #1 on: March 03, 2012, 11:47:49 am »
So is it possible to make certain pixels kill you?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Gravity Jump
« Reply #2 on: March 03, 2012, 02:31:31 pm »
You can add an enemy if you want, sure :) You can also create another buffer to hold killing pixels and you pixel test those buffers to figure out if you are on a bad space (that actually sounds like a really good idea o.o )

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Gravity Jump
« Reply #3 on: March 03, 2012, 06:06:02 pm »
Yeah, that works. Thanks! :)
Yeah, you could use that in one of your games.

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Gravity Jump
« Reply #4 on: March 09, 2012, 03:52:51 am »
The screenshot looks already very nice indeed. Well done. I'm pretty sure someone will make a platformer.


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Gravity Jump
« Reply #5 on: March 09, 2012, 01:47:05 pm »
That would be cool :) I will eventually try to make a method for a scrolling map, but I am not sure how I will handle enemies and whatnot :/

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Gravity Jump
« Reply #6 on: March 14, 2012, 07:01:47 pm »
Wouldn't enemies make the game real slow? Because you have to pxl-test for collision for the enemies?
« Last Edit: March 14, 2012, 07:02:00 pm by nxtboy III »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Gravity Jump
« Reply #7 on: March 14, 2012, 07:23:54 pm »
Well, think of it this way-- If I can do over 1000 pxl-tests in a second, then checking if I am in the kill zone will not be a problem at all.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Gravity Jump
« Reply #8 on: March 14, 2012, 09:08:01 pm »
Over 1000 pxl-tests in a second?? O.O
That's fast...

*  nxtboy III has a heart attack and drops dead

EDIT: My NXT can perfom about 2100 pxl-tests a second.

EDIT2: But it is really important for grayscale, isn't it? I mean, every millisecond counts.
« Last Edit: March 14, 2012, 09:19:27 pm by nxtboy III »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Gravity Jump
« Reply #9 on: March 14, 2012, 09:20:52 pm »
Yeah, we went over this before, didn't we? :P (in another topic) It can do over 3500 at 15 MHz

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Gravity Jump
« Reply #10 on: March 14, 2012, 09:26:52 pm »
It can do over 3500 at 15 MHz

O.O
Dang... I wish my NXT was that fast. :(

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Gravity Jump
« Reply #11 on: March 15, 2012, 04:00:57 am »
believe me, the nxt is MUCH better than the calc:
Specs:
Quote

Main processor: Atmel® 32-bit ARM® processor, AT91SAM7S256
- 256 KB FLASH
- 64 KB RAM
- 48 MHz
Co-processor: Atmel® 8-bit AVR processor, ATmega48
- 4 KB FLASH
- 512 Byte RAM
- 8 MHz
Bluetooth wireless communication CSR BlueCoreTM 4 v2.0 +EDR System
- Supporting the Serial Port Profile (SPP)
- Internal 47 KByte RAM
- External 8 MBit FLASH
- 26 MHz
USB 2.0 communication Full speed port (12 Mbit/s)
4 input ports 6-wire interface supporting both digital and analog interface
- 1 high speed port, IEC 61158 Type 4/EN 50170 compliant
3 output ports 6-wire interface supporting input from encoders
Display 100 x 64 pixel LCD black & white graphical display
- View area: 26 X 40.6 mm
Loudspeaker Sound output channel with 8-bit resolution
- Supporting a sample rate of 2-16 KHz
4 button user-interface Rubber buttons
Power source 6 AA batteries
- Alkaline batteries are recommended
- Rechargeable Lithium-Ion battery 1400 mAH is available
Connector 6-wire industry-standard connector, RJ12 Right side adjustment

/topicbreaker

Anyway, ontopic:
This looks really nice, I should really learn Grammer :\

I'm not a nerd but I pretend:

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: Gravity Jump
« Reply #12 on: April 05, 2012, 09:11:14 am »
Where the heck was I?

Well, this is just cooool and VERY usfull for other stuff... :)

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

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: Gravity Jump
« Reply #13 on: April 05, 2012, 09:16:21 am »
This looks nice Xeda. Hopefully it gets some use by others. :)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Gravity Jump
« Reply #14 on: April 05, 2012, 12:48:10 pm »
Hmm, I posted a screenshot somewhere where this also included hitbox detection, too... I should find it and remake some more of this sometime :D