Swift Posted March 23, 2008 Share Posted March 23, 2008 It's like learning a whole new UDF with 10000 functions! I can't even think of the possibility, ive only seen your demo, and I cant do anything more... Link to comment Share on other sites More sharing options...
jpam Posted March 23, 2008 Author Share Posted March 23, 2008 Another Rotate example this one creates a brand new sprite. expandcollapse popup#include <Prospeed.au3> Opt("MouseCoordMode",0) Opt("GUIOnEventMode", 1) HotKeySet("{Esc}","_exit") $gui = GUICreate("Sprites",800, 400) GUISetState() Background("Your BackgroundImage", 0, 0,800,400) $load = loadsprite("count.gif") $W = GetBmpHeight($load) $tmp = CreateExtBmp(244,244) CopyExtBmp($tmp,0,(244-$W)/2,244,244,$load,0,0,-1) $array1 = InitExtFX($tmp) $bitmap = CreateExtBmp(244,244) $array2 = InitExtFX($bitmap) $spritepic = CreateExtBmp(2440,244) $w = 0 For $i = 1 To 359 Step 36 Rotate($spritepic,$w,0,$array2,$array1,$i,0) $w +=244 Next SaveExtImage($spritepic,"C:\new_sprite.bmp",1,10) ; <= Save new generated sprite $Sprite = sprite($spritepic, 0, 0, 244, 244, 10, 1, 6, 200,40) SetmovingRectangle($Sprite,0, 0, 800-244, 400-244) While 1 movesprite($Sprite,Random(0,800,1),Random(0,400,1)) Sleep(1000) WEnd Func _exit() FreeAllExtBmps() FreeExtFX($array1) FreeExtFX($array2) Exit EndFunc Link to comment Share on other sites More sharing options...
monoceres Posted March 23, 2008 Share Posted March 23, 2008 Here we go again (sorry for being so needy): What if I wanna create a sprite from a bitmap in memory? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jpam Posted March 23, 2008 Author Share Posted March 23, 2008 $spritebitmap = LoadExtMemory($S_pointer, $S_size)Here we go again (sorry for being so needy):What if I wanna create a sprite from a bitmap in memory? Link to comment Share on other sites More sharing options...
monoceres Posted March 23, 2008 Share Posted March 23, 2008 I don't have LoadExtMemory() function, have I missed something? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jpam Posted March 23, 2008 Author Share Posted March 23, 2008 redownload the prospeed.au3 udf from http://prospeed-jan.xprofan.com/i just updated it Link to comment Share on other sites More sharing options...
Swift Posted March 23, 2008 Share Posted March 23, 2008 jpam, im having some problems, I cant get Water to work right.. I want to use the picture in the demo, I even tried using the demo, but it said Error: Cannot dedeclare a constant...So...And I wanted that...oh well, guess maybe not today...or ever Link to comment Share on other sites More sharing options...
monoceres Posted March 23, 2008 Share Posted March 23, 2008 I don't get the size parameter, the program always crashes, here's the code I've been struggling with: #include <GUIConstants.au3> #include "prospeed.au3" #include "cardgame.au3" Opt("GUIOnEventMode",1) Global $width=700 Global $height=500 Global $cardwidth=100, $cardheight=184 $parent = GUICreate("testing",$width,$height) GUISetOnEvent($GUI_EVENT_CLOSE,"close") GUISetState() $hdc = GETHDC() Background("background.jpg",0,0,$width,$height) $png = ImportPNG(1,"cards.png") $bitmap = CreateExtBmp(1300, 735) PaintPng(1, $bitmap, 0, 0, $png, 0) ; Used this to get the size of the bmp ;~ SaveExtImage($bitmap, "output.bmp", 0, 0) $spritebitmap = LoadExtMemory($bitmap,2866554) while 1 sleep(10) WEnd Func close () FreeAllExtBmps() freepng(1,$png) Exit 0 EndFunc To clarify things, what I've been trying to do is load a big png image with 52 playing cards and then using them as sprites. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jpam Posted March 23, 2008 Author Share Posted March 23, 2008 (edited) you png Width must can be divided by 4 check your png dimentions ! Edited March 24, 2008 by jpam Link to comment Share on other sites More sharing options...
Swift Posted March 23, 2008 Share Posted March 23, 2008 (edited) jpam, im having some problems, I cant get Water to work right.. I want to use the picture in the demo, I even tried using the demo, but it said Error: Cannot dedeclare a constant...So...And I wanted that...oh well, guess maybe not today...or ever EDIT: oops, I quoted myself.. Edited March 23, 2008 by R6V2 Link to comment Share on other sites More sharing options...
monoceres Posted March 23, 2008 Share Posted March 23, 2008 you png height must can be divided by 4check your png dimentions !That's not a problem (736%4=0)It works when i comment LoadExtMemory() Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
SadBunny Posted March 24, 2008 Share Posted March 24, 2008 Hey JPAM! Thanks for your help on the flip thing. After hours of experimenting, I think I new get the hang of it (though I dropped the FlipY in favor of the Lighten effect). So I made the game I spoke about (Bubble Breaker).http://members.chello.nl/~b.bergsma5/BubbleBreaker.zipThis zip is a little over 6 megabites in size. But that's no problem, considering the nice mp3 soundtrack and sounds. I created everything myself, so I might be biased, but I believe it's worth it. Also my game reads oud your score aloud when you quit, using FruityLoops voice generator samples. In other words, it costs a couple of bytes in sound samples but it pays off! The zip contains a bunch of .jpg pictures, ofcourse prospeed.au3 and .dll (http://www.autoitscript.com/forum/index.php?showtopic=38549), and another couple of .mp3 sound files used in the game. And ofcourse BubbleBreaker.au3 which is what you'll want to run. I included a compiled BubbleBreaker.exe for easy access But feel free to use the .au3 ofcourse. Hope you like it! Let me know!Note: all music, sounds and graphics have been created from scratch by myself. Software used: Photoshop CS2, FruityLoops 6 and WaveLab 5. Equipment: Roland EXR7 synthesizer as midi device.BubbleBreaker.au3 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
jpam Posted March 24, 2008 Author Share Posted March 24, 2008 LoadExtMemory($bitmap,2866554) only use it if you have loaded a picture in a dllstruct Where did you get that number from ? ($bitmap,2866554) #include <GUIConstants.au3> #include "prospeed.au3" #include "cardgame.au3" Opt("GUIOnEventMode",1) Global $width=700 Global $height=500 Global $cardwidth=100, $cardheight=184 $parent = GUICreate("testing",$width,$height) GUISetOnEvent($GUI_EVENT_CLOSE,"close") GUISetState() $hdc = GETHDC() Background("background.jpg",0,0,$width,$height) $png = ImportPNG(1,"cards.png") $bitmap = CreateExtBmp(1300, 735) PaintPng(1, $bitmap, 0, 0, $png, 0) $Sprite = sprite($bitmap, 0, 0, 184, 100, 1, 1, 1, 200,40) ;<= you have to specify the offset in the bitmap for every card while 1 sleep(10) WEnd Func close () FreeAllExtBmps() freepng(1,$png) Exit 0 EndFunc Link to comment Share on other sites More sharing options...
monoceres Posted March 24, 2008 Share Posted March 24, 2008 Well since it said size, I thought it was the size of the bitmap in the memory, so I dumped the bitmap from the memory and looked up it's size Anyways thanks for fixing my code Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jpam Posted March 24, 2008 Author Share Posted March 24, 2008 @SadBunny ! Very nice done SadBunny ! i like it alot but you should implant a replay option, so we dont have to start the exe everytime my kids love it too @monoceres sorry i was wrong with the png dimentions it must be Width/4 Link to comment Share on other sites More sharing options...
monoceres Posted March 24, 2008 Share Posted March 24, 2008 (edited) I don't know if this a bug or something but when I try to use the BringSpriteToTop() function on the first sprite I created from a bitmap in memory the program always crashes, here's an example: #include <GUIConstants.au3> #include "prospeed.au3" Opt("GUIOnEventMode",1) Global $width=700 Global $height=500 $parent = GUICreate("testing",$width,$height) GUISetOnEvent($GUI_EVENT_CLOSE,"close") GUISetState() $hdc = GETHDC() $png = ImportPNG(1,"cards.png") $bitmap = CreateExtBmp(1300, 735) PaintPng(1, $bitmap, 0, 0, $png, 0) $Sprite = sprite($bitmap, 0, 0, 100, 184, 1, 1, 1, 200,40) $Sprite2 = sprite($bitmap, 0, 0, 2*100, 184, 1, 1, 1, 200,40) BringSpriteToTop($sprite) ; CRASH! BringSpriteToTop($Sprite2); Doesn't crash while 1 sleep(10) WEnd Func close () FreeAllExtBmps() freepng(1,$png) Exit 0 EndFunc Edited March 24, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jpam Posted March 24, 2008 Author Share Posted March 24, 2008 no bug. you can't use BringSpriteToTop() on first created sprite i will mention it in the udf for the next update i can ask frank to protect it , so it dont crash on the first created sprite but it could take a while to fix it, because frank is very buzzy at the moment you can work around to create a dummy sprite and place it offscreen Link to comment Share on other sites More sharing options...
monoceres Posted March 25, 2008 Share Posted March 25, 2008 That's exactly what I did It is really sweet working with Sprites though, will hopefully release my card game I've been busy with tomorrow! Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
SadBunny Posted March 25, 2008 Share Posted March 25, 2008 BubbleBreaker replaced by version v1.01 http://members.chello.nl/~b.bergsma5/BubbleBreaker.zip- Now with unlimited 'play again' functionality as requested by JPAM- better looking highlit bubbles (not only lit but also blurred and flipped)- better mouse handling (no ugly GuiGetMsg PrimaryDown/Up stuff, now using WinAPI, way better)- better sound handling (sounds opened only once, or actually closed after use, prevents memory leaks and crashes)- improved logic and interoperability of functions- better protection for prospeed.dll's habit to mess up GUI when the mouse is off the GUI or when app is not active/focused- increased volume of sine sweep sound played when a column disappears (it's cooler now, trust me )- algorithm improved for joined-bubble-array seeking- multiple minor memory leaks fixed, program runs faster not and there should be no more crashes Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
monoceres Posted March 25, 2008 Share Posted March 25, 2008 @jpam I just wanted to say that I just released my card game and I couldn't have done with you! Thanks a bunch! Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now