+ 1
Hey I have a Question.
I had written a code in html css and js to move a box using buttons. I have a question that if I create a div in another div then why does the inner div come out of the outer div when we try to move it out of the outer div using the buttons? Why doesn't it stay in? I don't want ready made code but I just want someone to explain this to me. Here is the code: https://code.sololearn.com/W2ni45MOD4ZE/?ref=app
10 odpowiedzi
+ 3
1-
if u dont want it to go outside of the div
just add
//left
if(f>0)
f--;
and
//right
if(f>=widthof the div)
f++;
and
//up
if(t>0)
t--;
//down
if (t<=height of div)
t++;
2-
on css
add
body{
user-selection:none;
}
to not select the text in the buttons
3-
its better to use canvas for games
+ 3
Thank you Med Yassine for your answer. It helped me understand the problem.
+ 3
Here you will find something similar:
https://www.w3schools.com/graphics/game_intro.asp
+ 2
Arjun Dawande
That all you can learn in Sololearns game development with Javascript.
+ 2
JaScript but I am not able to find any course named game development with JavaScript.
+ 2
Arjun Dawande You go to section Learn, then click on selection above and click on „discover all courses“ to see all offered courses.
Or click here:
https://sololearn.com/learn/courses/le-gamedev-with-js
+ 2
I can see that in Sololearns app. Did you try that in the app or in the website?
+ 2
Maybe the course was old and is in the meantime deleted.
+ 2
Thanks JaScript
+ 1
Hey JaScript I clicked on the link that you provided but it is taking me to the Angular course which I have already completed. I also tried to find it in the discover all courses option but that course is not there.
I think they have removed that course.