Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / 18 line tiny wings!

Author
Message
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 22nd Apr 2012 13:02 Edited at: 22nd Apr 2012 13:02
Okay so this incomprehensible pile of code is actually a quite working example of the popular mobile game tiny wings. I believe the real game is made using a physics engine like box2d but lacking that i decided id go with the maths approach instead.

The game is really simple. although there are no levels or such in this game and you cant "die" it still works like tinywings.
press SPACEKEY to increase gravity which will cause you to accelerate downwards. if timed correctly this will allow you to use the hills as ramps, proppeling you forward with greater speed. and like in the real game you can get a "spree", symbolized here by your ball changing color. You get it if you land 2 times in a row nicely. (that is smoothly)

oh and again a2dplugin used and probably matr1x utils too










29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 23rd Apr 2012 12:21
That's pretty cool.

I've never played Tiny Wings (never even heard of it until now) but I think in game play terms I would've added in a point scheme for things like height of jump and how long the ball was in the air for and used the "spree" as a kind of multiplier but that's all pretty minor.

Could you post an expanded version as I would like to see how you created the wavy line and got the ball to follow it.
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 23rd Apr 2012 18:57
in the real game you get score for all kinds of things including the things you just said I just made this program to prove that i could to a friend

sure, though im not sure how enlightening it will be as it is SLOPPY code.

i can explain the important stuff in it.

the wavy line is simply a complicated sine function ((sin(0.4*i)+cos(0.05*i)*sin(0.2*i))*150)

then i have calculated the derivate of it ((pi()*(16*cos(0.4*i)+5*cos(0.25*i)+3*cos(i*0.15)))/48.0)
the derivate says the value of incline the wavy line has at any point on the curve. now i have stored those values in arrays as to be faster than having to recalculate the complicated function again and again.

then i simple terms i compare the balls value of "incline" (kinda how steeply it is moving) and compare it to the wavy lines value of incline. The more similiar they are the smoother the landing is kinda. then its just vectors after that.

29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 1st May 2012 23:43
Thanks for posting that.

I wouldn't worry about sloppy code, in my last 20 line challenge I I managed to leave in an entire function that was no longer being used.

I want to have a go at making a dirt bike game a bit like this:

http://www.freewebarcade.com/game/max-dirt-bike-2/

and thought the way you created the line and got the ball to land on it would be a good starting point.

Thanks again.
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 2nd May 2012 16:22 Edited at: 2nd May 2012 16:25
no problem! sure but my line code would not suffice for that one. It is not capable of doing some of the shapes that came up there. or actually yes it could but then you would have to have some extra code in there.

the code for making the map would be extremely advanced. It would have to be able to derivate ( correct word?) the lines and curves you would draw, something im not sure of how to do unless you stick to basic shapes and curves.
But its definitely doable

the bike itself would be a tad harder to get right too as it has two wheels instead of just one semiwheel as in my code.

Good luck !
jobromedia
11
Years of Service
User Offline
Joined: 9th May 2012
Location: Stockholm, Sweden
Posted: 12th May 2012 13:02
Getting this error in the original code you posted in your first post:
Quote: "Subscript must be Integer or DWORD when referencing an array at line 11."


Best regards
Johan Brodd
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 13th May 2012 13:07
weird. i dont get it when i tried it. maybe you lack matr1x plugins?

Login to post a reply

Server time is: 2024-04-19 08:58:27
Your offset time is: 2024-04-19 08:58:27