Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asteroids - increased ship, asteroids and font size #2983

Merged
merged 4 commits into from
Sep 11, 2023

Conversation

hughbarney
Copy link
Contributor

No description provided.

@bobrippling
Copy link
Collaborator

Looks good to me, will merge around this time tomorrow if the other maintainers don't mention anything :)

@gfwilliams
Copy link
Member

well, it'd be nice to get a response from @hughbarney about that change to how asteroids are drawn - I feel like as there are generally quite a few of them it could make the game quite a lot slower - and the change to transformVertices would be pretty easy

@bobrippling
Copy link
Collaborator

Ah gotya - the poly drawing replacing the circles for example?

@gfwilliams
Copy link
Member

Yes - poly draw itself should be ok, but I imagine constructing the polygon each time for every asteroid might slow things down

@hughbarney
Copy link
Contributor Author

hughbarney commented Sep 8, 2023

Yes it does make the game a bit slower. It is a lot nicer to look at.

I am afraid I dont know what 'and the change to transformVertices would be pretty easy' would mean in practice.

    g.drawPoly([
      a.x           , a.y - 1.5 * a.rad,
      a.x + a.rad   , a.y              ,
      a.x + a.rad/2 , a.y              ,
      a.x + a.rad/2 , a.y + a.rad/2    ,
      a.x           , a.y + a.rad      ,
      a.x - a.rad   , a.y              ,
      a.x - a.rad   , a.y - a.rad
    ],true);

I guess the suggestion is that there might be a more efficient way of calculating the points.
But I'm afraid my knoweldge of graphics tricks or manipulating shapes does not run much further.

@gfwilliams gfwilliams merged commit 0b96c2f into espruino:master Sep 11, 2023
@gfwilliams
Copy link
Member

Just done it - I made the asteroids rotate too

The only issue with this is playing it, I've found there are clear times when the bullet now passes right through an astroid, because at times it's drawn at 1.5x the actual radius

@hughbarney
Copy link
Contributor Author

hughbarney commented Sep 12, 2023

Thank you Gordon. It looks very nice. Sorry I did not know about g.transformVertices(), did not realise you meant using a built in function. I wondered if some sort of collision detection function could be added, eg g.polygonsOveralp(p1,p2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants