Version Française English Version Casio Planet - Programs, materials and games for Casio calculators Bookmark and Share
Welcome to the new Planet-casio website! Tell us what you think of it on the forum!
Casio Forum - Programming problems

Index | Programming problems | LuaFX Problem
Mfisch
Offline
Status: Member
Level: Good
Points: 195
Challenges: 0
Message
Submitted on 20/10/2011 19:14

LuaFX Problem:

Hi,
Here is my problem. I am trying to get LuaFX to display a sprite with this code:


local wait = misc.wait
--Sprite - Name: arrow, Width: 24px, Height: 24px
local arrow_spr=$$$$$$$$ -- the forum will not let make a post with the characters that the real sprite has in it

spritexy 57,41,arrow_spr
wait(100)



All I get is Executing Test!!! and then the calc restarts. The sprite is not displayed.


Please help!

flyingfisch

smileysmiley
[spoiler]w00t! I have a blog!

smiley
smiley[/spoiler]




Purobaz
Offline
Status: Member
Level: None
Points: 2575
Challenges: 110
Message
Submitted on 20/10/2011 20:20 |
I advise you to write :

local wait=misc.wait
local arrow_spr="xxxx" -- check if it's a good sprite, coded with Vebveb's compiler

graydraw.setcolor(true) -- essentiel to use sprite mode

clear nil
pushxspr 57
drawspr 41,arrow_spr -- an other way used by Vebveb to draw a sprite
refresh -- display the invisible screen

repeat
wait(3)
until key(5) -- wait EXE


Sorry about my english, because i'm french
----------------------------------
I'll be back !
[spoiler=pour plus de fun|mes programmes fun]PictureTool
Escape prison
Bloxorz
Free wheel
QR code
Nombre en or
[/spoiler][spoiler=de technique|mes projets]RayCasting
smiley
[/spoiler][spoiler=et de Swag|les projets que je soutiens]Calc Center
Mario Party
Zelda
et Planète Casio
[/spoiler]
Mfisch
Offline
Status: Member
Level: Good
Points: 195
Challenges: 0
Message
Submitted on 21/10/2011 06:09 |
Oh wow, thanks for the prompt reply!

A few questions:

what does pushxspr and drawspr do and what is the syntax? also, what does repeat do?

Thanks,

flyingfisch
----------------------------------
smileysmiley
[spoiler]w00t! I have a blog!

smiley
smiley[/spoiler]

Purobaz
Offline
Status: Member
Level: None
Points: 2575
Challenges: 110
Message
Submitted on 21/10/2011 08:40 |

pushxspr x
drawspr y,sprite

are 2 usual functions coded by Vebveb. They are faster and need this syntax.
pushxspr x moves the sprite at x position.
drawspr y,sprite moves the sprite at y position and then draws the sprite in the invisible screen.

repeat
until

is a simple loop. The condition is key(5), so you have to press EXE to quit the loop (you can also use key(0) which return true if at least one key is pressed).

I added wait(3) to slow the loop. It's necessary to get the key.
----------------------------------
I'll be back !
[spoiler=pour plus de fun|mes programmes fun]PictureTool
Escape prison
Bloxorz
Free wheel
QR code
Nombre en or
[/spoiler][spoiler=de technique|mes projets]RayCasting
smiley
[/spoiler][spoiler=et de Swag|les projets que je soutiens]Calc Center
Mario Party
Zelda
et Planète Casio
[/spoiler]
Mfisch
Offline
Status: Member
Level: Good
Points: 195
Challenges: 0
Message
Submitted on 21/10/2011 17:34 |
Thank you very much

Now i have another problem... I can get it to display the mario sprite (i copy and pasted), but apparently my sprite wont work. I had orwell's sprite maker set to black and white, and then used this code to make a luaFX sprite. (eiyeron gave the code to me):


foo = {0x1F, 0xFF, 0xF8, 0x3F, 0xFF, 0xFC, 0x40, 0x00, 0x02, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0xC7, 0x80, 0x03, 0xC3, 0xC0, 0x03, 0xC1, 0xE0, 0x03, 0xC0, 0xF0, 0x03, 0xC0, 0x78, 0x03, 0xC0, 0x3C, 0x03, 0xC0, 0x1E, 0x03, 0xC0, 0x3C, 0x03, 0xC0, 0x78, 0x03, 0xC0, 0xF0, 0x03, 0xC1, 0xE0, 0x03, 0xC3, 0xC0, 0x03, 0xC7, 0x80, 0x03, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0x40, 0x00, 0x02, 0x3F, 0xFF, 0xFC, 0x1F, 0xFF, 0xF8}
out = io.open("Prog.lua", "w") -- l'ancien sera effacé
foo2=string.char(unpack (foo)); -- on remplace foo par le nom du sprite
out:write(("sprite = %q"):format(foo2));
out:close()
io.write(string.byte("n"))



Am I doing something wrong?
----------------------------------
smileysmiley
[spoiler]w00t! I have a blog!

smiley
smiley[/spoiler]

Purobaz
Offline
Status: Member
Level: None
Points: 2575
Challenges: 110
Message
Submitted on 21/10/2011 18:27 |
To draw sprites i use sprite maker which is include into Flash 100.

Then, i think your code is wrong.
It should be :


foo ={
{0x1F, 0xFF, 0xF8, 0x3F, 0xFF, 0xFC, 0x40, 0x00, 0x02, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0xC7, 0x80, 0x03, 0xC3, 0xC0, 0x03, 0xC1, 0xE0, 0x03, 0xC0, 0xF0, 0x03, 0xC0, 0x78, 0x03, 0xC0, 0x3C, 0x03, 0xC0, 0x1E, 0x03, 0xC0, 0x3C, 0x03, 0xC0, 0x78, 0x03, 0xC0, 0xF0, 0x03, 0xC1, 0xE0, 0x03, 0xC3, 0xC0, 0x03, 0xC7, 0x80, 0x03, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0xC0, 0x00, 0x03, 0x40, 0x00, 0x02, 0x3F, 0xFF, 0xFC, 0x1F, 0xFF, 0xF8}
}

stringfoo={
"sprite_name"
}


...



Can you give me your picture, i will try to do the sprite.
----------------------------------
I'll be back !
[spoiler=pour plus de fun|mes programmes fun]PictureTool
Escape prison
Bloxorz
Free wheel
QR code
Nombre en or
[/spoiler][spoiler=de technique|mes projets]RayCasting
smiley
[/spoiler][spoiler=et de Swag|les projets que je soutiens]Calc Center
Mario Party
Zelda
et Planète Casio
[/spoiler]
Mfisch
Offline
Status: Member
Level: Good
Points: 195
Challenges: 0
Message
Submitted on 21/10/2011 21:31 |
OK, i figured it out... eiyeron and i chatted at omnimaga for about 20 min and figured it out

Thanks!
----------------------------------
smileysmiley
[spoiler]w00t! I have a blog!

smiley
smiley[/spoiler]



Index | Programming problems | LuaFX Problem
Search :
Adverts and parteners

Space-Raider

Casio Games - www.planet-casio.com v3.0 © created by Neuronix and Muelsaco 2007 | There are 43 visitors | Contact us | Search List | Links
Forum Commun Casio | Sublinet | Rugby Manager | Handball Manager | Nova Raider