Warp

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Warp

Post by tentus »

I've clearly been watching too much Star Trek lately. I sat down and wrote a very, very simple app that would render something similar to the warp effect (the stars flying by the window).

Controls:
Up: increase speed.
Down: decrease speed.
Left: rotate counterclockwise.
Right: rotate clockwise.
+ / = / kp+: add a star.
- / _ / kp-: delete a star.
Space: toggle pause.
Tab: toggle smoothing.
Escape: exit app.

Thoughts, comments, improvements?
Attachments
warp.love
Version 8 (smooth acceleration, keypad support).
(1.52 KiB) Downloaded 221 times
Screenshot of version 2. This predates smoothing.
Screenshot of version 2. This predates smoothing.
warp.gif (1.09 KiB) Viewed 5358 times
Last edited by tentus on Fri Mar 09, 2012 6:14 pm, edited 10 times in total.
Kurosuke needs beta testers
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Warp

Post by slime »

Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Warp

Post by tentus »

slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).
Kurosuke needs beta testers
User avatar
SoggyWaffles
Citizen
Posts: 72
Joined: Sun Jan 02, 2011 3:27 am
Location: Wyoming, USA

Re: Warp

Post by SoggyWaffles »

Brings back memories of Flying Toasters.....
"Beneath the clouds lives the Earth-Mother from whom is derived the Water of Life, who at her bosom feeds plants, animals and men." ~Larousse
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Warp

Post by slime »

tentus wrote:
slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).
The tail lengths need to increase/decrease as your speed increases/decreases though. :P
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Warp

Post by tentus »

slime wrote:
tentus wrote:
slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).
The tail lengths need to increase/decrease as your speed increases/decreases though. :P
Oh I gotcha I thought you were referring to the star speed, not the camera speed. Hmm. I'll think on it.

In the meantime, I introduced a smoothing option. The old code is still there, you can see it in action by hitting space to toggle smoothing.

Does anyone else find it a little weird that the ImageData stuff is all indexed at 0, rather than 1 like most of the rest of Love? I mean, it's not a big deal, it's just a little jolting the first time you mess it up and Love crashes without an error.
Kurosuke needs beta testers
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Warp

Post by kikito »

The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?
When I write def I mean function.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Warp

Post by tentus »

kikito wrote:The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?
Yeah, I need to figure out the discrepancy (offset x somehow)?

Considering how short the app is, I don't think adding multiple directions would be too hard. The easiest thing to do would be adjust the size of it and use love.graphics.rotate.
Kurosuke needs beta testers
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Warp

Post by tentus »

kikito wrote:The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?
Alright, rotating is now in effect, use the arrow keys, and you can pause using space. Adding and deleting stars is now done with plus and minus, and toggling smoothing is now done with tab. The position bug should be fixed now, after a ton of fiddling around (end solution: flip the image backwards, the math for displacing it to the left was just too easy to break).
Kurosuke needs beta testers
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Warp

Post by kikito »

Nice!

I've noticed that the lines thickness increases with velocity - that's intentional, right?
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests