Jump to content

absorr

Recommended Posts

If you were able to make an object bounce in another language, Javascript shouldn't be any different, the concept is the same. Javascript is capable of making games, but if you want efficiency, you should try another language. Java and Flash are more efficient than Javascript. A lot of Java IDEs are free, I use NetBeans. You have to pay for a Flash editor.

Link to comment
Share on other sites

how do i make it so that the object can move and bounce off walls?
something like this should work:
canvasWidth = 500canvasHeight = 500 function target() {	this.x = 0	this.y = 0		this.moveX = 1	this.moveY = 1		this.checkEdgeHit = function() {		if (this.x <= 1) // left			this.moveX = 1		else if (this.x >= canvasWidth) // right			this.moveX = -1				if (this.y <= 1) // top			this.moveY = 1		else if (this.y >= canvasHeight) // bottom			this.moveY = -1	}		this.move = function() {		this.checkEdgeHit()				this.x += this.moveX		this.y += this.moveY				this.render()	}		this.render = function() {		//context.arc( ... )	}}

Link to comment
Share on other sites

  • 2 months later...

Archived

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

×
×
  • Create New...