Camera
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Camera
Okay, theres alot of problem, first of all, i suggest that you put proper indentation in the codes inside the function block, put spaces after each "end" in function. Second, as ive pointed out before, put all your global require in the main.lua file, because youre requiring the same module in many files which is inconvenient.
Anyways, i dont see any errors. Whats the problem?
Anyways, i dont see any errors. Whats the problem?
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Camera
KyleFlores1014 wrote: ↑Sat Jun 03, 2017 9:43 am game.love here is the code i already wrote the switch function but it still makes an error because of the font when you click about
It's because of your switch function. Instead of using the
Code: Select all
state:exit()
state:load()
Code: Select all
state.exit()
state.load()
AND ALSO, youre not using the switch function. You dont put a function in your game and then just let it there without actually using/calling it. Instead of using your old method of just saying
Code: Select all
state = newState
Code: Select all
switchState(newState)
Example
Code: Select all
startButton = {
img = "img",
x = 120,
y = 120,
width = 32,
height = 32
}
--in checking
if mouseX > startButton.x and mouseX < startButton.x + startButton.w then
--rest of code
end
--drawing them
love.graphics.draw(startButton.img,startButton.x,startButton.y)
Oh, here you go. I've fixed your gamestate switching.There's still some errors because of the way you hardcoded the checking in mouse functions.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
-
- Citizen
- Posts: 73
- Joined: Thu May 25, 2017 1:43 pm
Re: Camera
Oh sorry about the mousepressed it was button not id
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Camera
It's (x,y,button,istouch) dont forgetKyleFlores1014 wrote: ↑Sat Jun 03, 2017 10:10 am Oh sorry about the mousepressed it was button not id
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
-
- Citizen
- Posts: 73
- Joined: Thu May 25, 2017 1:43 pm
Re: Camera
here is my new code but the mouse function ruined it and the mouse function no longer works but im trying to fix it
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Camera
Yes, when i fixed your mousepressed function, your code doesn't work the way it supposed to because of your hardcoded value, as ive pointed in the post above.KyleFlores1014 wrote: ↑Sat Jun 03, 2017 1:42 pm game.love here is my new code but the mouse function ruined it and the mouse function no longer works but im trying to fix it
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
-
- Citizen
- Posts: 73
- Joined: Thu May 25, 2017 1:43 pm
Re: Camera
So how do i fix it I mean I can rewrite it again
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Camera
Yes, rewrite it again. Make variables for your "text" positions, and use that variable for checking if mouse was pressed inside thar button box. See my post above for clarification
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
-
- Citizen
- Posts: 73
- Joined: Thu May 25, 2017 1:43 pm
Re: Camera
So im beginning to rewrite my code but i still get the same error i dont know whats wrong with my code
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests