Qbasicnews.com
May 26, 2020, 06:10:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Jumping Platform games  (Read 1864 times)
Xerosis
New Member

Posts: 6


« on: July 25, 2004, 04:26:44 PM »

Ive only recently got back into qbasic and already im struggling. Im doing a basic platform game, using characters jumping from platform to platform until they reach the goal. My problem is how to identify what the character cant go through (plus my jumping itself isnt too good). Ive looked over the net for a while and only managed to find one thing, but the problem is my game is in screen 0 and i cant find a way to stop things falling without using the POINT command. If someone could help me with either some code for jumping or some code to help with defining the platforms i would appreciate it a lot. By the way my character is just an ascii character and so are all the levels made up of them.

thx in advance.
Logged

img]http://xerosis.sheer-design.com/images/mo48.jpg[/img]
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #1 on: July 25, 2004, 04:35:26 PM »

Use an array to hold your game world, don't rely on the screen's contents. If you check your character positions against the array, not only is it faster but it's more reliable.
Logged

I'd knock on wood, but my desk is particle board.
Xerosis
New Member

Posts: 6


« Reply #2 on: July 25, 2004, 04:37:24 PM »

maybe i should of put this in beginner help  :Huh:
Logged

img]http://xerosis.sheer-design.com/images/mo48.jpg[/img]
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #3 on: July 25, 2004, 04:57:21 PM »

I dunno what you've got already... but if you want a decent-looking parabolic jump:

Consider every co-ordinate as a floating-point value. Then, whenever an object does not have a firm surface below it, increase its vertical-velocity by whatever the gravity factor is.

When you want to jump, instantaneously set the vertical-velocity to some negative number... your character will jump upwards, gradually be slowed down by gravity, drop again, and speed up as he falls. Exactly as it should be.

And before you write anything to the screen, just round off your x and y positions to temporary variables and use those in your LOCATE. (If speed becomes an issue, there's a much quicker way to write to the screen using DEF-SEG and POKE -- memory address is B800:0000)

Mike
Logged

DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #4 on: July 27, 2004, 02:11:50 PM »

A platformer in text mode?!? (memory address is B800:0000)  :-?

But yes (simplification follows!), gravity is a constant acceleration, which means that the y velocity of an object affected by gravity will change linearly, and the y position will change exponentially, as in a parabola.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #5 on: July 27, 2004, 03:42:47 PM »

Platformer in text mode:

http://usuarios.lycos.es/firstqbasicforum/stuff/nadya.html

Cheesy

(you can grab complete source code of how it works, I think I remember that it was somewhat commented, but I may be wrong).
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
NovaProgramming
Been there, done that
*****
Posts: 1025



« Reply #6 on: July 27, 2004, 11:58:10 PM »

Sounds like fun.... How would you go about making something like that in the first place?  I'm so newbish sometimes that I surprise myself.  I can figure out most simple mathematical equations, and I think I'm good, lol.  Keep us posted on your progress, and post some code and whatnot! Cheesy
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!