Sure, dude. There's a working idea with example code posted in this thread that includes pretty much everything you need, and also descriptions of an alternative implementation with quads. You should now try to adapt one of those ideas, and come back when you have more questions.
Mother 3's Rolling Meters.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Mother 3's Rolling Meters.
Re: Mother 3's Rolling Meters.
I already wrote that I tried to create this thing for about four days. I tried several ideas, and upper one i tried too.grump wrote: ↑Tue Sep 12, 2017 3:55 pmSure, dude. There's a working idea with example code posted in this thread that includes pretty much everything you need, and also descriptions of an alternative implementation with quads. You should now try to adapt one of those ideas, and come back when you have more questions.
I would not come here if I was not in despair.
Code: Select all
function love.load()
love.event.quit()
end
Re: Mother 3's Rolling Meters.
But... there is a working solution right there, with a description of the basic concept too. What do you expect should happen now?
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Mother 3's Rolling Meters.
We're not gonna code the thing for you.
Edit: Lol entitlement.
Edit: Lol entitlement.
Last edited by zorg on Tue Sep 12, 2017 6:51 pm, edited 1 time in total.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Mother 3's Rolling Meters.
Sure thanks for help.
(Sarcasm)
(Sarcasm)
Code: Select all
function love.load()
love.event.quit()
end
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: Mother 3's Rolling Meters.
If you still need help, can you ask another question? I looked at grump's code and it seems to be what you wanted (a way to simulate the rolling numbers from the game you mentioned)
Have you tried to implement the code that was given to you? Was it not what you were asking for in the first place? What problems are you having that we could attempt to help you troubleshoot?
I notice you posted
Edit: Wow, so you're leaving the forums because no one understands/has an answer for the questions you didn't ask. If you happen to return to this forum, even if it's just to lurk, this is for you OP http://www.catb.org/esr/faqs/smart-questions.html#code
Have you tried to implement the code that was given to you? Was it not what you were asking for in the first place? What problems are you having that we could attempt to help you troubleshoot?
I notice you posted
But that isn't really a questionThe most hardest part in my opinion is actually getting these digits work by turn.
For counter wheel I use ImageFont and canvas.
Edit: Wow, so you're leaving the forums because no one understands/has an answer for the questions you didn't ask. If you happen to return to this forum, even if it's just to lurk, this is for you OP http://www.catb.org/esr/faqs/smart-questions.html#code
Last edited by Sir_Silver on Tue Sep 12, 2017 8:42 pm, edited 1 time in total.
Re: Mother 3's Rolling Meters.
In a DIY rainmeter skin I've implemented rolling meter by having a vertical sprite with all the digits on it. It would be used as a texture for a "quad" and the texture coordinate would shift depending on the value of that digit. You could I guess make a bunch of sprites for every possible roller position, like from 0 to 9 and a few places in between each digit. I also made a bunch of sprites with vertical blur applied, so that the rollers could spin fast and it would look fast rather than jittery, which sprite would be used was selected based on digit rolling speed.
Re: Mother 3's Rolling Meters.
It's kind of funny, but I could swear there was an additional topical response here that just got deleted without notice.
Re: Mother 3's Rolling Meters.
Okay, I just came to say that I just finally created that thing.
Thanks to raidho36 for good explanation, and understanding.
grump, your solution was useless.
So, if anyone needs, here's the code.
This code is dirty, but it works.
Thanks to raidho36 for good explanation, and understanding.
grump, your solution was useless.
So, if anyone needs, here's the code.
Code: Select all
meter = {}
meter.__index = meter
function meter:new(font, cells, init_value, speed)
local o = {}
o.font = font or love.graphics.newFont(32)
o.width = o.font:getWidth'0'
o.height = o.font:getHeight()
o.cells = cells
o.value = init_value or 0
o.actualValue = o.value
o.speed = speed or 7
o.cell = {}
o.canvas = love.graphics.newCanvas(o.width, o.height * 11)
o.canvass = love.graphics.newCanvas(o.width*o.cells*2, o.height)
love.graphics.setCanvas(o.canvas)
local oldf = love.graphics.getFont()
love.graphics.setFont(o.font)
for i = 0, 10 do
love.graphics.print(i%10, 0, i * o.height)
end
love.graphics.setFont(oldf)
love.graphics.setCanvas()
for i = 1, cells do
o.cell[i] = {value = o.value, shift = o.value*o.height, setted = false}
end
return setmetatable(o, self)
end
function meter:__add(v)
self.value = self.value + v
return self
end
function meter:__sub(v)
self.value = self.value - v
return self
end
function meter:set(v)
self.value = v
return self
end
function meter:update(dt)
if self.actualValue < self.value then
self.actualValue = self.actualValue + self.speed * dt
if self.actualValue >= self.value then self.actualValue = self.value end
elseif self.actualValue > self.value then
self.actualValue = self.actualValue - self.speed * dt
if self.actualValue <= self.value then self.actualValue = self.value end
end
for i, v in ipairs(self.cell) do
local val = self.actualValue/(10^(self.cells - i))
val = math.floor(val)
val = val * self.height
if v.setted == false then
v.shift = val
v.setted = true
end
if val > v.shift then
v.shift = v.shift + self.speed * self.height * dt
if v.shift > val then v.shift = val end
elseif val < v.shift then
v.shift = v.shift - self.speed * self.height * dt
if v.shift < val then v.shift = val end
end
end
love.graphics.setCanvas(self.canvass)
love.graphics.clear()
for i, v in ipairs(self.cell) do
love.graphics.draw(self.canvas, (i-1) * (self.width + 1), -( v.shift % (10 * self.height)))
end
love.graphics.setCanvas()
end
function meter:draw(x, y)
love.graphics.draw(self.canvass, x, y)
end
Code: Select all
function love.load()
love.event.quit()
end
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Mother 3's Rolling Meters.
I mean, there's always more than one way of accomplishing things.
With or without canvases.
With or without scissors.
With print statements, text objects, or sprite atlases; with or without quads.
But hey, at least you got it working...even if it seems highly inefficient.
With or without canvases.
With or without scissors.
With print statements, text objects, or sprite atlases; with or without quads.
But hey, at least you got it working...even if it seems highly inefficient.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Google [Bot] and 3 guests