Jump to content

2D game


Html

Recommended Posts

Because Flash apps are compiled, not interpreted, and the Flash player is dedicated to running them, while browsers have to handle JS execution + HTML parsing + CSS rendering + etc... all of which is interpreted.

Link to comment
Share on other sites

  • Replies 78
  • Created
  • Last Reply

This is sort of the same question i asked before.Having a shape move towards an area 1-3 seconds into the js file loading etcThen just dissapears.What about the ability to fire a pixel from one shape?

Link to comment
Share on other sites

You don't "fire a pixel from a shape". All you have is objects. If you want a picture of a ship or something, then you use a picture of a ship. It has a position (left and top coordinates), a width, height, etc. I'm not sure if you can use Javascript to rotate an image, I don't think I've seen that done if you can. If you want the ship to shoot something, then you create a new object , probably below the ship object instead of above it, and it can be a picture of a missile or whatever you want. You give it an initial position and size, and set some variables for velocity and direction. Every time the loop to animate the picture runs it will increment the position of the object by whatever the velocity is in the direction specified. That involves geometry and algebra, dealing with things like radians and angular movement. There's a fair amount of math involved. But there's no "ability to fire a pixel from one shape".

Link to comment
Share on other sites

I'm not sure if you can use Javascript to rotate an image, I don't think I've seen that done if you can.
You can rotate an image with Canvas.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...