How to use collisions?
How to use collisions?
Hi guys. I wanna using collisions but I don't know. Can your help me?
Re: How to use collisions?
Yes, we can help you, but you have to specify your question.
If you have, please upload a .love-file and tell us, what exactly you want to implement.
If you have, please upload a .love-file and tell us, what exactly you want to implement.
Check out my blog on gamedev
Re: How to use collisions?
Please also remember that you can use different methods to detect collisions. (love.physics or just a if statement check)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to use collisions?
Collisions is kind of a big field. What you are asking is similar to asking "I wanna use math but I don't know".nikneym wrote:Hi guys. I wanna using collisions but I don't know. Can your help me?
What exactly are you trying to achieve? I.e. what kind of game?
When I write def I mean function.
Re: How to use collisions?
I'm solve. Here is my code:
Thanks.
Code: Select all
function love.load()
yazfont=love.graphics.newImageFont("font/yazi.png"," abcdefghijklmnopqrstuvwxyz1234567890!?");
love.graphics.setFont(yazfont);
fare=love.graphics.newImage("images/fare.png");
love.mouse.setVisible(false);
love.mouse.setGrab(false);
--Fizik !
dunya=love.physics.newWorld(0,9,64*81,true);
obje={};
obje.karakter={};
obje.karakter.body=love.physics.newBody(dunya, love.graphics.getWidth()/2,love.graphics.getHeight()/2,"dynamic");
obje.karakter.shape=love.physics.newCircleShape(20);
obje.karakter.fixture=love.physics.newFixture(obje.karakter.body,obje.karakter.shape,1);
obje.karakter.fixture:setRestitution(0.2);
obje.karakter.x=love.graphics.getHeight()/2;
obje.karakter.y=love.graphics.getWidth()/2;
obje.zemin={};
obje.zemin.body=love.physics.newBody(dunya,love.graphics.getWidth()/2,love.graphics.getHeight());
obje.zemin.shape=love.physics.newRectangleShape(love.graphics.getWidth(),32);
obje.zemin.fixture=love.physics.newFixture(obje.zemin.body,obje.zemin.shape,1);
end
function love.update(dt)
dunya:update(dt);
if love.keyboard.isDown("escape") then
love.event.quit("quit");
end
--Fare
fareX, fareY=love.mouse.getPosition();
end
function love.draw()
--Arkaplanı Çiz
love.graphics.setBackgroundColor(255,255,255);
--Fare
love.graphics.draw(fare, love.mouse.getX() - fare:getWidth() / 2, love.mouse.getY() - fare:getHeight() / 2);
--Zemin
love.graphics.polygon("fill",obje.zemin.body:getWorldPoints(obje.zemin.shape:getPoints()));
--Karakter
love.graphics.setColor(30,30,30);
love.graphics.circle("fill",obje.karakter.body:getX(),obje.karakter.body:getY(),obje.karakter.shape:getRadius());
end
Who is online
Users browsing this forum: No registered users and 3 guests