|
Post by johnno56 on Aug 18, 2020 0:51:00 GMT -6
Does anyone have code for a side scrolling platformer - like Mario - tilebased would be ideal but pixelbased in a pinch. I have searched for tuts but most are for Scratch, Gamemaker or Unity. I think 'pete's qbasic' site may have some but not sure if they are complete - old as dirt... lol
Kennn mentioned Kenney's graphics and it got me to thinking... I have most of Kenney's art work and figured I may as well see if I can use them... who knows... Maybe the makings of our own tutorial...
Any assistance would be appreciated...
J
|
|
|
Post by aurel on Aug 18, 2020 11:34:01 GMT -6
I think that can find few on FreeBasic forum.
|
|
|
Post by johnno56 on Aug 18, 2020 13:08:20 GMT -6
Thanks Aurel. I will check it out... Cool.
|
|
|
Post by tbird on Sept 8, 2020 17:55:13 GMT -6
Do you want my "Bob" code? Its kinda my engine specific, but you could probably use something??
|
|
|
Post by johnno56 on Sept 8, 2020 18:33:01 GMT -6
Thanks Tbird. Much appreciated.
|
|
|
Post by tbird on Sept 9, 2020 9:21:11 GMT -6
Ok here is the link for the source, and basically the early iteration of my engine, without the editor of course, that's still too embarrassing for the wild lol. It has 2 versions which will "run" "bob.bas" and "bob_NonBucket.bas" essentially the same thing the second has my first attempt at using buckets for game partitioning and debug printed, the first is just the game. Amazingly they both work, the possibly helpful bits wold be around line 350 in the collision engine. Quick reminder this is arbitrary collision not tile based, with some physics set in the main bob.bas file then used in the collision engine. Scene files are obviously the level and such. Have a look and see if it helps at all.
|
|
|
Post by johnno56 on Sept 10, 2020 2:06:37 GMT -6
I was expecting a simple "go kart" class platformer but you have presented a classic "Rolls Royce" class platformer... This level of programming is beyond my meager talents... I cannot guarantee that I will be able to make 'heads nor tails' of it, but I will check it out. Many thanks.
J
ps: I like the 'skulls'...
|
|
|
Post by tbird on Sept 10, 2020 7:21:39 GMT -6
If you need an explanation on something ask away, I know my commenting ability is not very good, it's getting better. Its all just positions and box collision and then what you do when one is detected. The physics are plain but functional.
The character has 4 points to better simulate a platform character, so the entire character can't stand with 99% of his body on an edge without falling, and the points also help with top bottom collisions.
|
|
|
Post by johnno56 on Sept 10, 2020 10:00:15 GMT -6
I suppose I am "old school" when it comes to platformers... Either a bunch of DATA lines or and external file to hold the map information. Read and interpret the data to draw the map. Place the player and navigate. Navigate would involve checking the tile that the player is moving toward, if it is "occupied", no movement... etc... But I don't need to be telling you all this... When I extracted your program I was amazed to see so much content... It's going to take me "a month of Sunday's" to get through all this... assuming I can follow it... lol
I think I will focus on the scrolling and collision. I suppose, if collision detection is not based on tiles, then the "4 point" system is quite effective. 99% you say... That has always be a "matter of choice" to determine how precise the detection field should be... Too exact and the player can 'hit' a circular object even though it doesn't "look" that way. In that case, the one playing, could feel 'cheated'. Making the 4 points too small can cause 'overlaps'. My solutions would be... Make the game a "runner"... The added speed will take care of too close or not... or shoot the bad guy long before to get to him... lol But, those 'solutions', would not be practical for a platformer... lol
As I work my way through the collision and scrolling, if I find anything confusing, I just may take you up on your 'explanation' proposal...
|
|
|
Post by johnno56 on Sept 10, 2020 18:29:44 GMT -6
Ok. My initial peek at your "maps", at first I found confusing, but as I continued reading I think it became clearer. Please correct me if I am wrong. Each and every "tile" (for want of a better word), is assigned a bunch of "attributes" - similar to QBasic's "Type'... End Type". My first question is: Are all your images placed on and "beyond" the screen when the level starts or are they "added" as the "camera" moves? I can understand the various attributes and how they can be modified if interacting with the player... But the background (clouds and mountains) require "attributes"? (apart from the x and y)
I may be completely "off the mark", but before I can work out the scrolling, I figured I would need to know how the "map" is rendered...
This is SO difficult (for me) to figure out, so please forgive the 'stupid' questions... It's like trying to learn from Einstein and I'm still using my fingers to count... lol Anyway... One step at a time... Always moving forward.
|
|
|
Post by tbird on Sept 10, 2020 19:16:47 GMT -6
Well how it works is everything in the program is an entity, they all have the same attributes, you are correct the scene is just holding all the information for characters, tiles, backgrounds etc... the camera function is really simple it just centers on the player. The render engine checks positions of entities and draws them as the camera approaches there position. That's why each entity has 2 sets of position variables there world position, and there camera position. I will look at the code again when I get home, I don't remember how, the old version of my engine works lol.
|
|
|
Post by tbird on Sept 10, 2020 19:40:54 GMT -6
Found a good code editor for my phone, so in the TBF_RenderEngine file it checks if an entity is on a layer then it adjusts its positions relative to the camera and thats how its drawn. My new engine streamlines the whole process and is way less code and is much faster....oh well you keep learning as you go.
PS also in the same file is the update camera function.
|
|
|
Post by tbird on Oct 25, 2020 10:34:30 GMT -6
johnno56 Did you make any headway? I would have asked sooner but I am finally getting caught up on farming duties, and will be more available. I remember a simple platformer that you yourself created so why not expand on that? Finally be nice to do some coding again!!
|
|
|
Post by johnno56 on Oct 25, 2020 17:21:17 GMT -6
To be honest, I haven't been doing much in the way of coding at all, in the past couple of months. I have a "list" of forums that I usually "haunt" several times a day... every day... and have noticed a sharp decline in activity in most of them... Understandable for the current climate (health-wise)... But when there is nobody around to chat to or seek advice... What did Einstein say, "Insanity: Doing the same thing over and over again and expecting different results..." or something like that... lol The conclusion is that I must be completely nuts... lol
Finding the motivation seems to be my biggest problem at the moment... *sigh*
But, you are correct, about expanding the platformer... I'm still not happy with the overall movement of the player... Possibly a problem with combined key detection and object collision. Once I have that ironed out that issue...
Both of my grandsons are into "running" side-scrollers... Not sure how to explain that one... Probably like a Mario Brothers on steroids... I suppose that, once I've gotten a handle on platformers, the 'running' type will no longer hold interest for them... Ha. But that seems to be normal for kids these days... lol
It's gone 10am here and I 'still' haven't had my first coffee...
|
|
|
Post by tbird on Oct 25, 2020 21:22:12 GMT -6
Ah, you mean the endless runner, yes my kids, and myself have played some of those. So yes Mario on roids is an accurate assessment. I totally understand, a lack of activity is unnerving, but I came from a previous engine that was in fact dead and abandoned, so this is busy by my standards lol.
I for one will be around more often now that life is slightly more settled.
|
|