++Karma is that a joke??? or is there a way to do that...
PS> I was offended by microshafts's paperclip... this must be as useful as tweezers when you need to go to the bathroom.
I am a firm believer that Microsoft Windows should be renamed tinyFlaccid Backdoors... It is apparent that it fails penetration testing...
REQUESTING HELP - Posting Rules
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: REQUESTING HELP - Posting Rules
I like your Love2D engine very much. I'm even making the project on it. I think that I will done it soon. But I doesn't like your file system. Of course, such desision like "\AppData\oaming\Love" can be enouth for games. However, this system is not good for programms, or even for small level editors at all(Yeah, I understand that I can solve that somehow), but this is too uncomfortably. Sorry for mistakes, but I still learning english.
-
- Prole
- Posts: 2
- Joined: Sun Feb 22, 2015 6:07 pm
Re: REQUESTING HELP - Posting Rules
Great rules! This will keep the forums nice and clean.
Re: REQUESTING HELP - Posting Rules
I approve this message
Re: REQUESTING HELP - Posting Rules
Hi. I'm new to love 2d, however my app just keeps showing no games. Is there anyone that can guide me through. Please
- Gunroar:Cannon()
- Party member
- Posts: 1142
- Joined: Thu Dec 10, 2020 1:57 am
Re: REQUESTING HELP - Posting Rules
You still here? I just noticed this like now .
You asked for help with a no game screen. If it's on android then the main.lua file isn't in directory lovegame. You didn't get help immediately because you posted it here. Should have made a topic then asked. .
Re: REQUESTING HELP - Posting Rules
Love2D isn't a game itself. It's framework for games. You still have to supply the .love game file. Once you have that, don't run Love2D itself - run the .love instead.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
-
- Prole
- Posts: 4
- Joined: Sat Jun 11, 2022 12:22 am
- Gunroar:Cannon()
- Party member
- Posts: 1142
- Joined: Thu Dec 10, 2020 1:57 am
Re: REQUESTING HELP - Posting Rules
So happy they could poop themselves
Re: REQUESTING HELP - Posting Rules
I am just learning to use Love2D. I’m trying to figure out how to make my player fire bullets and take the enemies. Could someone please advise me?
My main.lua code so far is below:
push = require 'push'
WINDOW_WIDTH = 600
WINDOW_HEIGHT = 500
VIRTUAL_WIDTH = 485
VIRTUAL_HEIGHT = 404
local backgroundScroll = 0
local midgroundScroll = 0
local groundScroll = 0
local enemyFrames = {}
local enemyframeWidth = 40
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local playerFrames = {}
local playerframeWidth = 40
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local enemy1Frames = {}
local enemy1frameWidth = 43
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local enemy2Frames = {}
local enemy2frameWidth = 41.6
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local BACKGROUND_SCROLL_SPEED = 5
local MIDGROUND_SCROLL_SPEED = 30
local GROUND_SCROLL_SPEED = 45
local MIDGROUND_LOOPING_POINT = 710
local BACKGROUND_LOOPING_POINT = 700
function love.load()
love.window.setTitle('Zombie Attack')
love.graphics.setDefaultFilter('nearest', 'nearest')
midground = love.graphics.newImage("sprites/midground.png")
background = love.graphics.newImage("sprites/background.png")
ground = love.graphics.newImage("sprites/ground.png")
sounds = {}
sounds.bg = love.audio.newSource("sounds/background.mp3", "stream")
sounds.reload = love.audio.newSource("sounds/reload.mp3", "static")
sounds.shooting = love.audio.newSource("sounds/shooting.mp3",
"static"
)
sounds.zombies = love.audio.newSource("sounds/zombiesound.mp3",
"static"
)
sounds.bg:play()
sounds.zombies:setLooping(true)
sounds.zombies:play()
logo = love.graphics.newImage("sprites/ZAlogo.png")
player = {}
player = love.graphics.newImage("sprites/player.png")
playerx = 40
playery = 300
shots = {}
shots = love.graphics.newImage("sprites/shots.png")
enemy = {}
enemy = love.graphics.newImage("sprites/Zombie1.png")
enemyx = 430
enemyy = 300
enemy1 = {}
enemy1 = love.graphics.newImage("sprites/Zombie2.png")
enemy1x = 430
enemy1y = 310
enemy2 = {}
enemy2 = love.graphics.newImage("sprites/Zombie3.png")
enemy2x = 430
enemy2y = 294
for frame = 1, totalNumberofFrames do
enemyFrames[frame] = love.graphics.newQuad((frame - 1) * enemyframeWidth, 0, enemyframeWidth, frameHeight,
enemy:getDimensions())
end
for frame = 1, totalNumberofFrames do
enemy1Frames[frame] = love.graphics.newQuad((frame - 1) * enemy1frameWidth, 0, enemy1frameWidth, frameHeight,
enemy1:getDimensions())
end
for frame = 1, totalNumberofFrames do
enemy2Frames[frame] = love.graphics.newQuad((frame - 1) * enemy2frameWidth, 0, enemy2frameWidth, frameHeight,
enemy2:getDimensions())
end
for frame = 1, totalNumberofFrames do
playerFrames[frame] = love.graphics.newQuad((frame - 1) * playerframeWidth, 0, playerframeWidth, frameHeight,
player:getDimensions())
end
push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
vsync = true,
fullscreen = false,
resizable = false
})
end
function love.keypressed(key)
if key == "space" then
sounds.shooting:play()
end
if key == "space" then
sounds.shooting:play()
end
if key == "r" then
sounds.reload:play()
end
end
function love.update(dt)
backgroundScroll = (backgroundScroll + BACKGROUND_SCROLL_SPEED * dt)
% BACKGROUND_LOOPING_POINT
midgroundScroll = (midgroundScroll + MIDGROUND_SCROLL_SPEED * dt)
% MIDGROUND_LOOPING_POINT
groundScroll = (groundScroll + GROUND_SCROLL_SPEED * dt)
% WINDOW_WIDTH
timePassedSinceLastFrameChange = timePassedSinceLastFrameChange + dt
if timePassedSinceLastFrameChange > desiredDelayBetweenFrameChanges then
timePassedSinceLastFrameChange = timePassedSinceLastFrameChange - desiredDelayBetweenFrameChanges
currentFrame = currentFrame % totalNumberofFrames + 1
end
enemyx = (enemyx- 0.5) % WINDOW_WIDTH
enemy1x = (enemy1x - 0.4) % WINDOW_WIDTH
enemy2x = (enemy2x - 0.3) % WINDOW_WIDTH
end
function love.draw()
push:start()
love.graphics.draw(background, -backgroundScroll, 0)
love.graphics.draw(midground, -midgroundScroll, 0)
love.graphics.draw(ground, -groundScroll, 0)
love.graphics.draw(enemy2, enemy2Frames[currentFrame], enemy2x, enemy2y)
love.graphics.draw(enemy, enemyFrames[currentFrame], enemyx, enemyy)
love.graphics.draw(enemy1, enemy1Frames[currentFrame], enemy1x, enemy1y)
love.graphics.draw(player, playerFrames[currentFrame], playerx, playery)
love.graphics.draw(logo, -250, -340)
love.graphics.draw(shots, 0, 170)
push:finish()
end
My main.lua code so far is below:
push = require 'push'
WINDOW_WIDTH = 600
WINDOW_HEIGHT = 500
VIRTUAL_WIDTH = 485
VIRTUAL_HEIGHT = 404
local backgroundScroll = 0
local midgroundScroll = 0
local groundScroll = 0
local enemyFrames = {}
local enemyframeWidth = 40
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local playerFrames = {}
local playerframeWidth = 40
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local enemy1Frames = {}
local enemy1frameWidth = 43
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local enemy2Frames = {}
local enemy2frameWidth = 41.6
local frameHeight = 72
local totalNumberofFrames = 4
local currentFrame = 1
local desiredDelayBetweenFrameChanges = 0.3
local timePassedSinceLastFrameChange = 0
local BACKGROUND_SCROLL_SPEED = 5
local MIDGROUND_SCROLL_SPEED = 30
local GROUND_SCROLL_SPEED = 45
local MIDGROUND_LOOPING_POINT = 710
local BACKGROUND_LOOPING_POINT = 700
function love.load()
love.window.setTitle('Zombie Attack')
love.graphics.setDefaultFilter('nearest', 'nearest')
midground = love.graphics.newImage("sprites/midground.png")
background = love.graphics.newImage("sprites/background.png")
ground = love.graphics.newImage("sprites/ground.png")
sounds = {}
sounds.bg = love.audio.newSource("sounds/background.mp3", "stream")
sounds.reload = love.audio.newSource("sounds/reload.mp3", "static")
sounds.shooting = love.audio.newSource("sounds/shooting.mp3",
"static"
)
sounds.zombies = love.audio.newSource("sounds/zombiesound.mp3",
"static"
)
sounds.bg:play()
sounds.zombies:setLooping(true)
sounds.zombies:play()
logo = love.graphics.newImage("sprites/ZAlogo.png")
player = {}
player = love.graphics.newImage("sprites/player.png")
playerx = 40
playery = 300
shots = {}
shots = love.graphics.newImage("sprites/shots.png")
enemy = {}
enemy = love.graphics.newImage("sprites/Zombie1.png")
enemyx = 430
enemyy = 300
enemy1 = {}
enemy1 = love.graphics.newImage("sprites/Zombie2.png")
enemy1x = 430
enemy1y = 310
enemy2 = {}
enemy2 = love.graphics.newImage("sprites/Zombie3.png")
enemy2x = 430
enemy2y = 294
for frame = 1, totalNumberofFrames do
enemyFrames[frame] = love.graphics.newQuad((frame - 1) * enemyframeWidth, 0, enemyframeWidth, frameHeight,
enemy:getDimensions())
end
for frame = 1, totalNumberofFrames do
enemy1Frames[frame] = love.graphics.newQuad((frame - 1) * enemy1frameWidth, 0, enemy1frameWidth, frameHeight,
enemy1:getDimensions())
end
for frame = 1, totalNumberofFrames do
enemy2Frames[frame] = love.graphics.newQuad((frame - 1) * enemy2frameWidth, 0, enemy2frameWidth, frameHeight,
enemy2:getDimensions())
end
for frame = 1, totalNumberofFrames do
playerFrames[frame] = love.graphics.newQuad((frame - 1) * playerframeWidth, 0, playerframeWidth, frameHeight,
player:getDimensions())
end
push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
vsync = true,
fullscreen = false,
resizable = false
})
end
function love.keypressed(key)
if key == "space" then
sounds.shooting:play()
end
if key == "space" then
sounds.shooting:play()
end
if key == "r" then
sounds.reload:play()
end
end
function love.update(dt)
backgroundScroll = (backgroundScroll + BACKGROUND_SCROLL_SPEED * dt)
% BACKGROUND_LOOPING_POINT
midgroundScroll = (midgroundScroll + MIDGROUND_SCROLL_SPEED * dt)
% MIDGROUND_LOOPING_POINT
groundScroll = (groundScroll + GROUND_SCROLL_SPEED * dt)
% WINDOW_WIDTH
timePassedSinceLastFrameChange = timePassedSinceLastFrameChange + dt
if timePassedSinceLastFrameChange > desiredDelayBetweenFrameChanges then
timePassedSinceLastFrameChange = timePassedSinceLastFrameChange - desiredDelayBetweenFrameChanges
currentFrame = currentFrame % totalNumberofFrames + 1
end
enemyx = (enemyx- 0.5) % WINDOW_WIDTH
enemy1x = (enemy1x - 0.4) % WINDOW_WIDTH
enemy2x = (enemy2x - 0.3) % WINDOW_WIDTH
end
function love.draw()
push:start()
love.graphics.draw(background, -backgroundScroll, 0)
love.graphics.draw(midground, -midgroundScroll, 0)
love.graphics.draw(ground, -groundScroll, 0)
love.graphics.draw(enemy2, enemy2Frames[currentFrame], enemy2x, enemy2y)
love.graphics.draw(enemy, enemyFrames[currentFrame], enemyx, enemyy)
love.graphics.draw(enemy1, enemy1Frames[currentFrame], enemy1x, enemy1y)
love.graphics.draw(player, playerFrames[currentFrame], playerx, playery)
love.graphics.draw(logo, -250, -340)
love.graphics.draw(shots, 0, 170)
push:finish()
end
Who is online
Users browsing this forum: Google [Bot] and 5 guests