|
Post by tbird on Dec 18, 2018 17:07:02 GMT -6
One quick thing I would like to point out for some added dyanmics, my wife landed once at a very fast lateral velocity, maybe include lateral limits as well. Just an idea.....so much for simple lol.
|
|
|
Post by johnno56 on Dec 18, 2018 18:21:57 GMT -6
Cool. Lateral maximum velocity. Brilliant idea. I will implement that when I add 'difficulties'. Perhaps a pre-game menu to select a level of difficulty. Yep. So much for simple... lol
|
|
|
Post by johnno56 on Dec 19, 2018 17:32:06 GMT -6
Here is the next version. I spent many, many moments drawing the highly detailed landscapes! Nah... Less than two minutes per level... lol There are now 9 levels... Some levels will select up to one of four possible landing sites. The lander will start, more or less, with a random x position.... The HUD is slightly modified. VSpeed and HSpeed will either be red for too fast or green for just right. Fuel will also change colour. Green for 66% or more. Orange for 33% to 66%. Red for less than 33% I have given you oodles of fuel. (I included heaps - for testing purposes - you believe me, right?) There could be some bugs and other inefficiencies. As usual, if you can suggest an improvements or changes, any help will be appreciated. J My brain hurts... Caffeine too low... Lethargic and listless... Tummy rumbles... Fridge raid!! Attachments:lunarlander3.zip (831.3 KB)
|
|
|
Post by tbird on Dec 19, 2018 22:01:09 GMT -6
Died 2 times, on the winning run ended with 323 fuel left, not bad I enjoyed the difficulty this time. As for improvements.....more level variety, or possible have a pickup and then takeoff to a second pad lol, I am not sure....good stuff either way, I enjoyed it very much.
|
|
|
Post by johnno56 on Dec 19, 2018 22:53:55 GMT -6
You must have read my mind...I prototyped this using Scratch with that very same concept. Launch from one pad to another - the next 'scene' would 'slide' across and you would launch from the last pad on the previous screen and land on the next etc... Kind of like a side scroller but without the scrolling... lol The 'scenes' that I had included a few that had a winding tunnel... If this idea is to take hold, then fuel 'pickups' would be a good idea, as launching as well as landing will require more fuel...
Pickups (other than fuel) sounds interesting. What did you have in mind?
In regards to difficulty, collision detection, is by biggest issue... I cannot find an algorithm that can be used for a moving shape (ship) intersecting with a static irregular shape (moon). Collision with the pad was just simple color detection. If there were multiple ships (ie: enemy) then color detection would impact performance...
I have seen some really old qbasic 'landers' and some have asteroids flying across the screen, an occasional UFO. My prototype had a landing pad that would transverse the screen... Only one time was I able to make THAT landing... Used a whole bunch of fuel in the attempt...
I have also seen a 'lander', actually it did't 'land', it took off to try and 'dock' with the command module before running out of fuel... The difficulty would be, after each successful docking, the player would start again on the surface and the command module would increase its speed whilst at the same time, the available fuel would decrease. A highscore would be kept... Oh! A highscore system...
I will investigate the 'launch technique' and try to figure out a simple top 5 pilots high score table (offline of course...)
Thank you for the comment and suggestions... So much for simple... lol
|
|
|
Post by tbird on Dec 21, 2018 16:55:20 GMT -6
Well pickups, such as fuel would be great, or possibly a gravity reducer pickup...many options lol. The docking on a moving module would be great, yes collision of odd shapes is a fun one! I cannot wait to see what you add. Simply complicated
|
|
|
Post by johnno56 on Dec 22, 2018 7:15:18 GMT -6
I may have figured out the 'moving pad' routine... One teeny problem... A bit of a compromise may have to be made... The idea is to time the landing on the pad 'just right'. The dilemma is that, the pad is bouncing too and fro across the srceen whilst the player is timing and flying the ship so as to land 'just right', but the ship has a maximum absolute lateral landing velocity of 1.0 Moving the pad across the screen, at a speed of 1 pixel, is going to make for a slow journey. Either the maximum lateral velocity needs to be increased or perhaps on the 'moving pad' level it could be ignored....
' Moving Landing Pad
sw = 800 sh = 600
WindowOpen(0,"MOVING PAD",0,0,sw,sh,0) CanvasOpen(0,sw,sh,0,0,sw,sh,0) window(0) Canvas(0) hideMouse()
randomize(timer)
padx = 100 +rand(620) pady = 300 direction = rand(2) + 1 padVelx = 3
setColor(rgb(0,255,0))
while key(k_escape) = 0 ClearCanvas
'DrawImage(1,padx,100) RectFill(padx,pady,80,20) if direction = 1 then padx = padx + padVelx if padx >= 720 then direction = 2 end if end if if direction = 2 then padx = padx - padVelx if padx <= 0 then direction = 1 end if end if
update() wend
This is a rough sample of moving the pad across the screen. Normally, I would use a sprite but for this example, just a filled rectangle. It seems to be a lot of code for such a simple function. Some efficiency tips would be appreciated....
I think I might go with the 'ignore' method and just make the ship 'stick' to the pad... assuming it lands ok of course... lol
A quick question: As RCBasic does not use sprite collision, would it be more efficient to 'draw' the 'ship' and 'pads' using graphic primitives instead of loading sprites? Just curious.
J
|
|
|
Post by tbird on Dec 22, 2018 8:11:21 GMT -6
The moving pad would be simple I believe, you would simply keep track of the difference in lateral velocity to determine a safe landing or not, if its traveling 6.5 to the right and your traveling 7 to the right when you land, Success!! Hmm more GUI elements, or just adjust the lateral velocity readout to a lateral velocity difference...or display both and make the player do math in his head to make sure its safe to land HAHA.
I would just use some bounding box collisions, they are fast and simple, for the pads and for the lander. As far as the images vs primitives, RC uses the GPU for a rendering so it is much faster at drawing images then primitives, cpu drawing is faster for primitives ( I think). I am pretty sure I read that somewhere, I may be mistaken....anyways, you won't have any performance issues in RC from a few images, or even a few thousand lol.
|
|
|
Post by johnno56 on Dec 22, 2018 9:22:26 GMT -6
Cool. I'm probably going to tackle this game tomorrow (Monday 24th) as it's almost 2:15am and I need to get some sleep. Got the grandkids over in about 8 hours and I won't have even enough time to scratch an itch, let alone work on some code... Ah, but no real problem, if I survive I can probably get some coding done the next day... Great bunch of kids, only they run at one volume - loud - but still, a great bunch of kids...
If I do survive, and it takes me longer to recover, just in case I forget.... Merry Christmas and a happy, safe and prosperous New Year to you all... Oh, I was soooo tempted to say y'all... But I didn't.... lol
J
|
|
|
Post by tbird on Dec 22, 2018 9:38:07 GMT -6
To you as well, enjoy your grandkids, they're grand for a reason .
|
|
|
Post by johnno56 on Dec 22, 2018 15:00:49 GMT -6
Woke up at 6:20am with this moving platform puzzle rattling around in the head... So much for a good rest... lol
Managed to code in the moving pad... Pad is bouncing from side to side; ship is being controlled; Ship lands on pad (ignoring the ships xvel for the moment) and game completes as it should. One would think that the job is done, right? Almost. Landing once may have been a fluke, happenstance, lucky... time and time again it worked like a charm.
Then I thought, 'That's ok if one is descending onto the pad. But what if the pad is missed?' Therein lies the problem. The ship can collide with the pad on the way up and as soon as both landing feet on the ship detects the pad, it thinks it had landed, and the game ends a winner... Meanwhile, for a few moments, the ship is stuck inside the pad.
I know, I know, 'Wouldn't a simple bounding box collision system work?' Yes it would. It will function perfectly, as it should, on all four sides. Whereas only the bottom side needs to detect the 'top' of the pad. Just had a thought... The pad's colour is rgb(0,160,0)... what if all four sided were a different colour. Not like Red, yell, green etc... what about a colour shift of about 5. eg: Top = rgb(0,160,0), Bottom = rgb(0,165,0) etc... To the eye, the differences, maybe indistinguishable but the machine would 'know'.. If the 'bottom' of the ship is touching the 'top' of the pad (and dependant on being the right colour) then is would register as 'landed'.
This will not be 'pixel perfect' but may suitable for a simple game. Ha! Simple... lol I remember, during my research into collision systems, that there is one where one or both four-sided 'objects' are moving... only wish I had written it down... Now I have to backtrack my searching... It's almost 8am and the family will be here soon... Best search quickly, eh? Oh dear. My wife is up and I can almost bet my last dollar that I will be asked to do some extra shopping... So much for research... lol
Now my brain hurts again... Too difficult to function on a non-existent level of caffeine...
|
|
|
Post by johnno56 on Dec 22, 2018 15:35:58 GMT -6
Oh. Forgot to mention... The version that I am working on has a simple menu system (How to play, play and quit) I will look into a high score table. I don't know RCBasic well enough to tackle an 'online' table... lol For now I will just go with what works...
J
ps: The family will not be here until after lunch... I could have slept in... Thank goodness for caffeine... lol
|
|
|
Post by johnno56 on Dec 24, 2018 23:40:21 GMT -6
Latest version #4.
Simple menu added. Single entry hiscore table. Mobile landing pad in last level. Collision on last level kind of works... Any suggestions would be appreciated.
J
ps: Getting a bit large and a little more complicated for my liking... lol
(totally mucked it up... I will try to recover from an earlier version... ugh! Don't you hate this when something like this happens?)
|
|
|
Post by tbird on Dec 30, 2018 1:32:58 GMT -6
I will have a go at this tomorrow, I am finally back programming again lol.
|
|
|
Post by tbird on Dec 30, 2018 22:17:36 GMT -6
Hmm johnno, I cannot D/L latest lunar lander says nothing there.
|
|