-
I am making a game with JavaScript classes and objects (what this repo is for). This is a sample of my code that is having problems: let text_object = {
left: $('.enemy').css('left'),
top: $('enemy').css('top'),
width: $('.enemy').css('width'),
height: $('.enemy').css('height')
}
text_object.left.replace('px', '');
text_object.left = parseInt(text_object.left);
text_object.top.replace('px', '');
text_object.top = parseInt(text_object.top);
text_object.width.replace('px', '');
text_object.width = parseInt(text_object.width);
text_object.height.replace('px', '');
text_object.height = parseInt(text_object.height);
enemy.moveToX = Math.round(Math.random() * (($(window).width() - text_object.left) - text_object.width));
enemy.moveToY = Math.round(Math.random() * (($(window).height() - text_object.top) - text_object.height)); The error message in the console is /cc @elijahparker |
Beta Was this translation helpful? Give feedback.
Answered by
MJP8
Apr 6, 2021
Replies: 1 comment
-
@elijahparker fixed it. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MJP8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@elijahparker fixed it.