SpritelyLoader = class()
-- This very simple class takes data that's stored
-- in the Sprightly global variable, and transfers
-- it to project data for your project.
-- For example:
-- myLoader = SpritelyLoader("spritely")
-- takes the image stored from the global SpritelyGlobal
-- and adds it to your project data as "bob"
-- Once in the project data, load the saved string to
-- an image using:
-- createImage = loadstring( readProjectData("bob"))
-- anImage = createImage()
function SpritelyLoader:init()
local keys, k, s
if readGlobalData("SpritelyKeys") == nil then
print("No Spritely data found.")
else
-- read global keys
keys = readGlobalData("SpritelyKeys")
saveProjectData("SpritelyKeys", keys)
print("Moving...")
for k in string.gmatch(keys,"([^,]+)") do
print(k)
s = readGlobalData(k)
saveProjectData(k, s)
end
print("Move complete.")
end
end
Also, how would I get a button to stay in the upper right corner? I have a game where you move up but I want the button to stay fixed in the top right corner. Is this possible?
I’m stuck on step 3. Delete the existing the Project.codea file from the Classes group and select Move To Trash.
I hate Xcode, and can’t navigate it at all. That is why I like and use Codea. So how do I find this Project.codea file or the Classes group. There are so many views, and I have no idea where to start. Please be gentle!
edit: Never mind. I just needed to click on the little triangle. No idea why that eluded me for so long!
Hi everybody
I’m new in this forum (and a new Codea user). I like this IDE (and Lua) very much. I’m impressed, how smart a small game can be developed. A big thanks to the maker of this genius piece of software.
First: sorry my poor english, hope, you understand my two questions about the runtime library (-;
→ I’ve developed a small topdown shooter (codea figher ) with 4 enemy waves and a boss, in witch i’ve used some sprites of the Tyrian Remstered spritepack. In my game, the sprites will zoom with factor 2 in this way:
If i run the game in codea, everything is all right, but if i compile my project with your runtime library in xcode, the sprites have the vanilla sizes. Is the zoom function not implemented yet and will this come in one of the next versions?
→ The other thing is, that the game runs very smooth inside codea with 60 fps, but the same version compiled in xcode runs with only ~30 fps. Is this ordinary?
@irusloy it sounds like you are getting 30 fps in the iPad Simulator? That is normal. The simulator is much slower than a real iPad.
The size problem is very odd — it could be due to a retina graphics bug. Do you have a small piece of sample code that misbehaves in the runtime? I’ll look into it using the sprite line you posted above.
Edit: Also if you plan to release your game on the iOS App Store please do not use the word “Codea” in the title of your game. (You may, however, mention Codea in the description and keywords for your game. Or in the game itself.) If you do not plan to distribute your game then don’t worry about it
Hi @Simeon, thank you very much for your reply. I don’t use the simulator, because i know the performance issue. I’ve used the iPad 3.
Concerning the sprite zoom, you’ve right: The iPad 2 shows the sprites correctly, the issue is only on the iPad 3.
The slow downs are on both devices; here the code samples. I use a class Enemy for draw the Enemies and a class EnemyFormation, in witch the formation will be moved (this will mean, self.position will set from the EnemyFormation class)
Enemy = class()
function Enemy:init(type)
self.sprite = {
"Tyrian Remastered:Enemy Ship C",
"Tyrian Remastered:Enemy Ship D",
"Tyrian Remastered:Enemy Ship C 1",
"Tyrian Remastered:Enemy Ship B",
"Tyrian Remastered:Boss A"
}
self.ship = self.sprite[type]
self.position = vec2(0,0)
....
self.width, self.height = spriteSize(self.sprite[type])
end
function Enemy:draw()
pushStyle()
if self.type == 1 then
tint(0, 196, 255, 255)
elseif self.type == 2 then --....
....
end
popStyle()
sprite(self.ship, self.position.x, self.position.y, self.width * 2.5, self.height * 2.5)
.....
end
If there are any typos in the code: never mind, write this post on my pc without copy/paste from the ipad
And of course, “codea fighter” is only the working title