Regarding the extensible records... Movable (Standable (Collidable (Drawable
{}))) sure is a mouthful isn't it? :-)  It looks like every thing in your
game is the union of all four type aliases... so why not just make it one
type alias?


OK, one last thing. This type definition...

type PossibleCollision = NoCollision | Collision CollisionType Float
(Float, Float)

I think the more idiomatic thing to do (but this might just be personal
taste) would be to define

type alias Collision =
    { collisionType : CollisionType
    , overlap : Float
    , velocity : Float
    }

And then in the places where you are using "PossibleCollision," use "Maybe
Collision" instead. The Maybe
<http://package.elm-lang.org/packages/elm-lang/core/4.0.5/Maybe> is super
useful for dealing with cases where you have either something or nothing. I
bet that you could shorten your collision detection code a lot by switching
to using Maybes. (For instance, you could use List.filterMap
<http://package.elm-lang.org/packages/elm-lang/core/4.0.5/List#filterMap>).







On Thu, Aug 18, 2016 at 4:07 PM, Nick H <[email protected]> wrote:

> (Well, I don't know if the reactor will be *replaced*, but a debug mode
> will be added, and it sounds like it will be much more useful for serious
> projects.)
>
> On Thu, Aug 18, 2016 at 4:04 PM, Nick H <[email protected]> wrote:
>
>> Couple of things I noticed:
>>
>> You are handling window resizing with a port. Elm has a Window module
>> <http://package.elm-lang.org/packages/elm-lang/window/1.0.0/> that can
>> handle this for you.
>>
>> Your Util.range can be replaced by built in syntax [ 0 .. max ]
>>
>> For list utilities, I highly recommend looking at
>> elm-community/list-extra
>> <http://package.elm-lang.org/packages/elm-community/list-extra/3.1.0/>.
>> Similarly, elm-community has dict-extra, maybe-extra, and a whole lot more.
>> Just search the package manager for "extra" and you will find a lot of
>> stuff!
>>
>> As far as formatting goes, yours looks pretty standard. Were you using
>> elm-format?
>>
>> Don't feel bad about abandoning the reactor. Evan has said
>> <https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/elm-dev/5Tm5_x7AfyQ/a5Kj8TNeCAAJ>
>> it's going to be replaced with a "debug" flag in the compiler. That will
>> allow some of the nice reactor features to be used in programs that are
>> embedded in HTML.
>>
>>
>> On Thu, Aug 18, 2016 at 1:43 PM, Thomas Ballinger <
>> [email protected]> wrote:
>>
>>> Thanks so much for taking a look! I've fixed (a likely cause of) the
>>> collision bug. It's fun to hear about your experience playing, despite the
>>> current lack of game experience. I'm a fan of the "ooooh it's tetris"
>>> realization (and ideally would like to time the music's transition to the
>>> tetris theme to this moment) so don't want to start out zoomed out, but
>>> plan to put off decisions about that until there's some gameplay. Let me
>>> know if you get a chance to look at the code.
>>>
>>>
>>> On Thursday, August 18, 2016 at 2:13:41 PM UTC-4, Will White wrote:
>>>>
>>>> Screenshot
>>>>
>>>> On Thursday, August 18, 2016 at 6:25:24 PM UTC+1, Will White wrote:
>>>>>
>>>>> Hi Thomas!
>>>>>
>>>>> I've played the game and I'd like to give you my thoughts on the UX. I
>>>>> may be able to review the code later. I wish I'd recorded my thoughts as I
>>>>> played.
>>>>>
>>>>> I ran right (it's Mario), bumped into a red wall. Ran left, same. What
>>>>> do I do? Ran right, green block has appeared. Jump over it. Oh, it's a
>>>>> Tetris block. Oh, the grey is where the block's coming down. 1 I get
>>>>> squashed and it bugs out (screenshot). I think I'm able to play on (arena
>>>>> not reset). "Tetris controls IJKL" Oh cool, I can control the Tetris 
>>>>> blocks
>>>>> too!
>>>>>
>>>>> Having a zoomed out view to start with (and then zooming in) would
>>>>> have got rid of all the thoughts up to 1. Knowing the Tetris controls
>>>>> earlier would have been fairer.
>>>>>
>>>>> Cool idea!
>>>>>
>>>>> On Wednesday, August 17, 2016 at 10:40:38 PM UTC+1, Thomas Ballinger
>>>>> wrote:
>>>>>>
>>>>>> Hi Elm folks! I've enjoyed reading this list for a bit. I've written
>>>>>> my first Elm thing over the last couple weeks and would love to hear any
>>>>>> kind of feedback on it. It's an unfinished game jam piece I kept running
>>>>>> with so the title doesn't make sense.
>>>>>>
>>>>>> code: https://github.com/thomasballinger/loveinthetimeoftetris
>>>>>> live: love.ballingt.com (takes about 70 seconds to play all of)
>>>>>>
>>>>>> I was going to clean things up the way I know how, but I need to take
>>>>>> a break to get some other things done and I thought I'd learn more by
>>>>>> asking how someone else might clean it up. Please don't assume I know 
>>>>>> what
>>>>>> I'm doing in the slightest :)
>>>>>>
>>>>>> Any feedback would be great, but if prompts are helpful:
>>>>>> * what does this code make it look like I'm missing about Elm?
>>>>>> * what do you think of the extensible record type aliases? I think
>>>>>> the way I've used them is mostly terrible, I designed them up front 
>>>>>> instead
>>>>>> of letting them evolve.
>>>>>> * code style?
>>>>>> * I'm using an elm autoformatter, how's my formatting? Is this style
>>>>>> common?
>>>>>> * I don't think I'll be using evancz/elm-graphics in the future since
>>>>>> I'll be doing less gamey stuff or want to work with canvas more directly.
>>>>>> How is this usually done?
>>>>>> * I abandoned elm reactor once I started embedding in html, is that a
>>>>>> viable workflow I should have stuck with for longer?
>>>>>> * I was tempted to start a utils file or look for an external lib but
>>>>>> was trying to focus on learning the stdlib. Are there pretty common util
>>>>>> libs folks use? I sure missed some list functions.
>>>>>> * I escaped to JavaScript anytime I thought it would be hard to do
>>>>>> something with the stdlib, presumably it would be nice to use Elm for 
>>>>>> some
>>>>>> of these things?
>>>>>>
>>>>>> Thanks so much, and feel free to contact off list if you prefer at
>>>>>> [email protected] - if you do I'll report back what I learned to the
>>>>>> list.
>>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to