in corona using sprites in flipbook - coronasdk

local Flipbook = `enter code here`require 'flipbook'
local myFirstFlipbook = Flipbook:newFlipbook("background_back.png", "mainshadow.png", "newshadow.png", "curlshadow.png" )
myFirstFlipbook:addPage( "backgroundA.png" )
myFirstFlipbook:addPage( "backgroundB.png" )
myFirstFlipbook:addPage( "backgroundC.png" )
Used the above code to implement the page curling effect
I want to add a sprite in one of the pages such that the sprite also curls as the page , and I am facing lots of issues implementing it
If anyone could guide me through this... would be a great help.

Related

I can't get my script that teleport's me then closes the textbox to work

What I am trying to do is the following : The player loads up my game, is greeted by 2 Text buttons asking, explore or play campaign, when they click for example 'Campaign' it teleport's them to the campaign start and then shuts the game menu, i am very new to Roblox Lua and can't get this script to work, please help!
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.character.LowerTorso.CFrame = CFrame.new(workspace.CampainSpawn.Position)
end)
function onClick()
Parent.Parent.Visible = false
end
The problem with your code is that you are not calling the onClick() function therefore it will never execute the code which makes your game menu invisible. Please tell me if the code below works for you:
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.character.LowerTorso.CFrame = CFrame.new(workspace.CampainSpawn.Position)
script.Parent.Parent.Visible = false
end)
If the code above does not work, please add a picture of the structure of the user interface in your original post as that will help me out a lot more.

GMOD Lua Use type doesn't matter?

recently I have been creating an imitation HarborRP gamemode for Garry's Mod, and I'm trying to recreate the Smuggler NPC (You'll know what I mean if you've ever played HarborRP) So basically I want the NPC to open ONE Derma-Frame window when the player presses their use key on it. I have the NPC created and all of that, but when the player simply presses their use key on the NPC, a million windows pop up, I have the NPC/Entity's use type set to SIMPLE_USE, but it seems like that doesn't matter because so many windows pop up. the VGUI/Derma Frame's settings is set to MakePopup() but that doesn't matter either. See if you can find whats wrong with it, I have very little knowledge of LUA.
init.lua file:
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
util.AddNetworkString("smug")
hook.Add("PlayerUse", "menuu", function(ply, ent)
net.Start("smug")
net.Send(ply)
end)
function ENT:Initialize()
self:SetModel('models/humans/group01/female_01.mdl')
self:SetHullType(HULL_HUMAN)
self:SetHullSizeNormal()
self:SetNPCState(NPC_STATE_SCRIPT)
self:SetSolid(SOLID_BBOX)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
end
cl_init.lua file:
include("shared.lua")
function ENT:Draw()
self.Entity:DrawModel()
end
net.Receive("smug", function()
if( !frame ) then
local frame = vgui.Create("DFrame")
frame:SetSize(900,600)
frame:SetPos(ScrW()/2-450,ScrH()/2-300)
frame:SetVisible(true)
frame:MakePopup()
frame:SetDeleteOnClose(true)
elseif (frame) then print("HI")
end
end)
shared.lua file:
ENT.Base = "base_ai"
ENT.Type = "ai"
ENT.PrintName = "[DEV] Smuggler NPC"
ENT.Category = "InVaLiD's HBRP Entities"
ENT.Author = "InVaLiD"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.AutomaticFrameAdvance = true
Something To Note
All of these files are in the addons/smug_npc/lua/entities/ folder.
Yes, I know I have weird names for things, that's just me.
I have a basic to no knowledge of lua, so explain things please :)
I really do appreciate your help, and your will to help people, please know that I thank you all for being here just to sort other people's problems even though you could be spending your time doing something productive, Thank you!
You need to put your code that does net.Send into the entities ENT:Use function rather than on the PlayerUse hook.
function ENT:Use(ply)
net.Start("smug")
net.Send(ply)
end
The below line which you already have in your code in the initialize function makes the entity call the ENT:Use function once when a player presses E on it, which it seems that you want to do so that is good:
self:SetUseType(SIMPLE_USE)
Also, I recommend checking out the gmod forums if you need developer help in future.
GMod forums: https://gmod.facepunch.com/f

Using perspective.lua for moving camera and object parralaxRatio

I develop my project using Corona SDK and creating successfully a "virtual moving camera".
The problem I have is about the parameter : ParallaxRatio() It seems it doesn't work, because my camera move the object in the same "speed". I would like the mountain & mountain2 move faster than the bkg_1.
Here is my code:
local perspective = require("perspective")
local camera = perspective.createView()
camera:add(hero,1,true)
camera:add(grass,2,false)
camera:add(mountain,3,false)
camera:add(mountain2,3,false)
camera:layer(3).parallaxRatio=0.5
camera:add(bkg_1,4,false)
camera:layer(4).parallaxRatio=0.2
camera:add(bg,5,false)
Just create a separate function to move the mountains along the x axis.
local function moveMountain(event)
mountain.x = mountain.x - 1.5
if mountain.x <removePoint then
mountain.x = player.x +950
end
end
Runtime:addEventListener("enterFrame",mountain)
Cloud_1.enterFrame = moveMountain

levelhelper-spritehelper-corona sdk- object collision

I'm trying to make a game like DoodleJump.
In the level(320x9600), position of an object(bar1_67)(of course there are lots of objects) is (177,263) and objects have physics shape. Requiring the "LevelHelper.LevelHelperLoader", I loaded the level:
...
local loader={}
--loading level
loader.level=LevelHelperLoader:initWithContentOfFile("level1.plhs")
loader.level:instantiateObjects()
loader.level:removeBackgroundColor()
local lhGroup=loader.level:layerWithUniqueName("MAIN_LAYER")
group:insert(lhGroup)
--to scroll the level, and start from the bottom of level
lhGroup.y=-loader.level.lhGameWorldRect.size.height+display.contentHeight
...
After this step, new Y position of the bar1_67 (according to the device screen) is about -9000s.
Then I added the player, requiring the "SpriteHelper.SpriteHelperLoader":
...
sLoader = require("SpriteHelper.SpriteHelperLoader")
local _player={}
_player.player=sLoader:createSpriteWithName("player","sprites","extra.pshs")
_player.player:setReferencePoint(display.centerReferencePoint)
_player.player.x=display.contentWidth*0.5
_player.player.y=display.contentHeight*0.4
...
When starting the simulator, yes level was scrolled, but player collided with something invisible and stayed in the air.
Then I added this code to see whats happening:
...
function aa(self,event)
if(event.phase=="began") then
print(event.other.x, event.other.y, event.other.lhUniqueName)
end
end
_player.player.collision=aa
_player.player:addEventListener( "collision", _player.player )
...
Output is :
177 263 bar1_67
But as I said level was scrolled and bar1_67 is out of screen. What can/should I do?
Please use gamedevhelper.com forum in order to help you with LevelHelper related questions.
I don't know whats going on in this case but would it be possible for you to send me the project to have a look?

Adding more than one frame one below the other of movie clip to the VBOx container?

I want to add frames of movie clip one below the other in the vbox. I tried this but it didn't worked out. Here getMovieClip is returning same movie clip, so when i am trying to use the same clip as two separate instance its not working. I basically need some method by which i can clone the Movieclip. Any help will be highly appreciated.
public function loadData(chunkIndex:Number):void{
var clip1:MovieClip = getMovieclip(1);
var clip2:MovieClip = getMovieClip(2);
clip1.gotoAndStop(1);
clipCont1.rawChildren.addChild(clip1);
clip2.gotoAndStop(2);
clipCont2.rawChildren.addChild(clip2);
}
]]>
</mx:Script>
<mx:VBox id="clipCont1"/>
<mx:VBox id="clipCont2"/>
<mx:VBox id="clipCont3"/>
</mx:VBox>
If anyone of you ever got stuck at cloning a movie clip. Then you should visit this page.
http://www.dannyburbol.com/2009/01/movieclip-clone-flash-as3/

Resources