Associate
- Joined
- 11 Oct 2008
- Posts
- 268
I'm trying to make a canvas elements position a little responsive.
I am using:
If it detects that it is being played on a mobile device, i would like it to change the line below (h: this.dh + ) so it either adds 130 or 300 to h: this.dh.
I cant seem to get it working, I'm guessing i've done something stupid wrong, but is there a way to merge these?
I am using:
Code:
if (ismobile) {
var mobileStop = 130;
} else {
var mobileStop = 300;
}
If it detects that it is being played on a mobile device, i would like it to change the line below (h: this.dh + ) so it either adds 130 or 300 to h: this.dh.
I cant seem to get it working, I'm guessing i've done something stupid wrong, but is there a way to merge these?
Code:
this.move = function() {
this.bounds = {
walking: {
x: this.x - 5,
y: this.y - 5,
w: this.dw + 10,
h: this.dh + ---> mobileStop here <----
}
}