hi
- User
hi
- Assistant
Hello! How can I assist you today?
- User
is this ok? const render = (entity: Entity) => { if (entity.geometry.shape === "polygon") { ctx.beginPath() const vertices = getVerticesCoords(entity) ctx.moveTo(vertices[vertices.length - 1].x,vertices[vertices.length - 1].y) for (let i = 0; i < vertices.length; i++) ctx.lineTo(vertices[i].x, vertices[i].y) } else { ctx.beginPath() ctx.arc(entity.geometry.vec.x, entity.geometry.vec.y,entity.geometry.radius, 0, Math.PI * 2, false) } ctx.strokeStyle = entity.visuals.activeColor ctx.fillStyle = entity.visuals.activeColor ctx.stroke() ctx.closePath() ctx.fill() }
loop.render(() => { ctx.clearRect(0, 0, canvas.canvas.width, canvas.canvas.height) entities.forEach(en => render(en)) entities.forEach(en => en.visuals.activeColor = en.visuals.color) checkCollisions(entities) move() })
- Assistant
- User
is this correct? export const getVerticesCoords = (polygon: Entity) => { const coords: Vector2d[] = [] for (let i = 0; i < polygon.geometry.vertices; i++) { const theta = Math.PI * 2 / polygon.geometry.vertices * i coords.push({ x: Math.cos(theta + polygon.geometry.angle) * polygon.geometry.radius + polygon.geometry.vec.x, y: Math.sin(theta + polygon.geometry.angle) * polygon.geometry.radius + polygon.geometry.vec.y }) } return coords }
- Assistant
The
getVerticesCoordsfunction you've provided appears to be intended for calculating the coordinates of the vertices of a regular polygon. This calculation seems to be based on how a regular polygon's vertices would be distributed evenly around a circle defined by a center point (vec) and a radius (radius).However, there are some things that you should verify or correct for this function to work as intended:
- User
- Assistant
- User
im p sure u have to hardcode colission response for a platformer u can just use simulation it wont feel right
- Assistant
- User
can i use mtv to tell which side ?
- Assistant
- User
should i use emscripten or rust ?
- Assistant
- User
for a 2d multiplatform game
- Assistant
- User
what about multithreading ?
- Assistant
- User
they both will use workers if compiled to browser and threads if compiled to os? u dont need to adjust anything?
- Assistant
- User
if i wanna reinvent the wheel by coding physics, renderer and aidio from scratch i should choose rust at this point?
- Assistant
- User
what about open gl in rust?
- Assistant
- User
- Assistant
- Assistant
It seems like your message is empty. How can I assist you further? If you have questions or need information on a particular topic, feel free to ask.
- User
is the collision code actually good?
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.