Can anybody here explain how the fuck [pressing X button in real life] becomes [character jumping on the screen]?
And I mean step by step. Like the whole chain of cause and effect. How the hell does this happen?
Yes I understand that when you press the X button it interrupts the current running through the circuit, but what happens beyond that?
Can anybody here explain how the fuck [pressing X button in real life] becomes [character jumping on the screen]?
You're fucking joking, right?
/g/ fag here
the game runs a looping piece of code that checks what electrical current from the controller (represented as a byte code) is being sent to the system. Say a controller has 4 buttons, then the default input would be 0b0000. If you press A the code being sent to the console would be 0b0001, if you press B 0b0010, press A and B together and it's 0b0011.
Now for the code part, the system just executes functions based on the byte code being sent.
Excuse me WHAT
You wanted to know how pressing a button becomes jumping on a screen.
That's how.
No you just spewed up some random bullshit you vaguely remembered from your Programming 101 course this is NOT what I'm asking AT ALL. I mean just look at all the empty spaces you left out in your "explanation". I said STEP BY STEP.
lol
But he's right and you're retarded
At this point it sounds like you're trying to make a game yourself and failing at the most basic task so you're trying to bait out code from someone here.
We're not doing your homework for you
FINGER PRESS JUMP BUTTON
BUTTON EJACULATES CODE TELLING THE CHARACTER TO JUMP
THE CHARACTER JUMPS
ITS FUCKING SIMPLE
self.frame = 0
self.health = 10
# jump code below
self.is_jumping = True
self.is_falling = False
def gravity(self):
if self.is_jumping:
self.movey += 3.2
ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False)
for g in ground_hit_list:
self.movey = 0
self.rect.bottom = g.rect.top
self.is_jumping = False # stop jumping
# fall off the world
if self.rect.y > worldy:
self.health -=1
print(self.health)
self.rect.x = tx
self.rect.y = ty
Ah, so you want more?
Study electrical engineering until you can make your own computer from scratch
Based but was more correct, the CPU loops over code that checks what's currently being sent. Inputs don't interrupt anything.
you kinda skipped the part of input handling
Based. On the software side, the y axis velocity of the player is set to a varying negative amount (depending on how long the button was pressed for, etc). There is also a gravity constant that is applied to the player's y velocity to work against that negative change in velocity, which gives the illusion of a jump reaching its peak and the player falling back to the earth.
Basically:
>Hit x button
>Player y-velocity = -1500.0f
>Each tick, gravity is applied to the velocity (-50.0f in this case)
>Player y-velocity eventually becomes greater than or equal to zero, causing player to stop moving upwards
>Player y-velocity is now greater than 0, which moves them downwards
>Player hits ground, and collision detection prevents them from falling through the earth
You can typically tweak the jump physics in the following ways
>Increase y-speed (causes ascent to be faster)
>Decrease y-speed (causes ascent to be slower)
>Increase gravity (jump hits its peak sooner, and descent is faster)
>Decrease gravity (jump hits its peak later, descent is much floatier)
Dude that's literally the explanation. If you don't understand it go and read any article online about loops in programs. You have to have a basic understanding of how things work to understand 'basics' of higher concepts.
Or do you need it explained from the ground up ie the big bang?
>retard comes in and asks to be spoonfed his homework answers
>anons willingly oblige
What the fuck happened to this site
kek
it’s a more interesting thread than half the shit on the catalogue
And I hate that you're right.
There's no guarantee the game was programmed in this way. Just because you've fucked around in Unity and that's how some faggot on Youtube told you how to do it, doesn't mean all platformers are done like this
coding is retarded.
Someone make a real coding language that doesn't require autism.
Something like :
If X then JUMP
Based retard.
I’ve been saying this for YEARS. How could someone POSSIBLY learn coding. It’s legitimately another language that isn’t even based on anything a normal person could comprehend.
If they can make the autism, why can’t they make something simple.
>I am smarter than several generations of computer engineers exclusively dedicated to computers
that dude was havin a laff mate, chill out relax a little i think retard op is gone
I’ve been saying this for YEARS. How could someone POSSIBLY learn french. It’s legitimately another language that isn’t even based on anything a normal person could comprehend.
Uh, in English, docs?
I think you two would be better off using this.
It's not programming 101, it's computer engineering 101.
You've never used python, have you?
start with turing machines and work your way up
I've been a professional C++ developer for over 15 years now, but nice projection, I guess?.
>the game
What, you want to know how Super Mario Bros. 3 SPECIFICALLY does it?
Mon Dieu!