Jump to content

absorr
 Share

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...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...