Lazarus1988's Forum Posts

  • Some time ago I wrote simple code in PHP to generate an image (captcha) and it works:

    http://scr.hu/1yl7/9608b[/code:5pnrwpy8]
    
    Today I again run code to make some documentation to improve it in future, but there is something weird...
    Output image looks like this:
    [code:5pnrwpy8]http://scr.hu/1yl7/63kgo[/code:5pnrwpy8]
    
    and here is full code:
    [code:5pnrwpy8]
    	<?php
    
    			function MakeRandomTxt($lenght = 5){
    				$characters = '!@#$%^&*()_+0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    				$charactersLength = strlen($characters);
    				$randomString = '';
    					for ($i = 0; $i < $lenght; $i++) {
    						$randomString .= $characters[rand(0, $charactersLength - 1)];
    					}
    				return $randomString;
    			}
    
    			
    		$rnd = MakeRandomTxt();	
    			
    		$string = $rnd;
    		$font_size = rand(24, 48); 
    		$width  = 140+imagefontwidth($font_size)*strlen($string); 
    		$height = 36+imagefontheight($font_size); 
    		$img 	= imagecreate($width,$height); 
    		$bg   	= imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255)); 
    		$color 	= imagecolorallocate($img, rand(0,255), rand(0,255), rand(0,255)); 
    		$len 	= strlen($string); 
    		$ypos 	= 14; 
    		
    		for($i=0;$i<$len;$i++){ 
    		
    			$xpos = 64+$i * imagefontwidth($font_size); 
    			imagechar($img, $font_size+20, $xpos, rand(2, $ypos), $string, $color); 
    			$string = substr($string, 1);    
    			
    		} 
    		header("Content-Type: image/png");
    		imagepng($img, './cp/'.$rnd.'.png'); 
    		imagedestroy($img); 
    		
    	?>
    [/code:5pnrwpy8]
    
    Pastebin version:
    [code:5pnrwpy8]http://pastebin.com/wDvNYwDm[/code:5pnrwpy8]
    
    What causing this problem?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes, very usefull. You know, I'm getting old but I remember when I was in Highschool (IT school) my teacher told me that

    [quote:2ldn2zit]One person can make great things, imagine what would create a group of individuals

  • I basically threw this together.. hope it helps some.

    https://dl.dropboxusercontent.com/u/666 ... oints.capx

    Thank you very very much <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /> I owe you big one ;]

  • There's probably MUCH better ways of doing this but something that comes to mind is that you could divide the track into zones, and each zone would have a range of directions (angles) the car is allowed to have, and if it's outside of those angles then it's going in the wrong direction. For example in the track you showed us, the left side of the track would restrict the car to angles 180 to 360 (or whatever). The right hand side would be 0 to 180, etc. To know which zone the car is in you could use invisible sprites that cover each zone and do an overlapping test with that sprite and the car, or check x,y coordinates to determine which zone the car is in.

    Another thought is that if the driver is collecting checkpoints in the wrong order, you'd know they are going in the wrong direction.

    Yes, the order of chekpoints would do the trick, but as you saw in my sheet there is set instance variable to Pick instance with lowest (variable) but (I don't know how it is possible) always counts checkpoint. In other words, Sprite called checkpoint has uniqe variable and I pick the lowest value of this variable but always when I get through checkpoint system counts that checkpoint as correct.

    If my words are too confusing I will provide necessary files.

  • I'm making top view racing game and almost everything works as I planned, except one thing.

    Player is able to pass current lap regardles he drives, either he drive clockwise or back clockwise laps and checkpoints are counted. OK checkpoint counter is fine, but I want to force on track only clockwise direction of driving.

    draft

    red arrows - direction I want to block

    green arrows - desired direction

    http://scr.hu/1yl7/ofufq[/code:3rt9axye]
    
    [i]Eventsheet[/i]
    [code:3rt9axye]http://scr.hu/1yl7/2rt6v[/code:3rt9axye]
    
    Thank you in advance.
  • Very usefull to create solar system simulator ;]

  • That's my guess it's with cookie, because i had 6 days counted and I cleared my web browser and now I have "0 days in row", I'm using CCleaner to keep my HDD clear so it clears also cookies. For 2 weeks or more whenever I run my PC i see "0 days in Row" in my profile.

    http://scr.hu/1yl7/x3krr[/code:35nn0z4h]
    
    But I don't think @Ashley, or @Tom, or any of Scirra staff would make such "noobish" error but if your suspection about editing cookies are correct then this would made major damage to Scirras reputation. Let's wait, maybe someone responsible for forum will provide us some comments...
  • Not only you have problem with it, the counter has reset to zero as you mentioned because the calculator uses cookies to count visits and probably that cookie responsible for counting days has been cleared either your browser or (if you have installed) some cleaning software (for example CCleaner)

    It's hardo to me to say but your effort has been completly wasted.

    Of course there is a slight chance to recreate (edit) newly created cookie by scirra's forum, but if you know how to do it properly. (Try search addon EditThisCookie for your web browser)

  • Thanks guys

    My gues was correct, path was too narrow. U see, when sprite with pathfind behavior is wider than path or collides with another (relativly overlaps with another object) it blocks because pathfind behavior cannot find free cell to move on. That's why some of my cars wouldn't move :]

    OffTopic: Here in south Poland we have +15 degrees of Celsius and I whole day I'm spending with construct 2. Heh... But still I like it

    I don't know why cars even they have solid option set and collision enabled after reaching destination they parking on themselves...

    http://scr.hu/1yl7/1pljj[/code:1e11yrgz]
  • It's better, thanks for help, but sometimes objects still won't start moving, I guess the path I drew is to narrow, I'll try with wider path.

  • I've started messing with pathfinding behavior and it's amazing, but I made a family with pathfinding and not all objects wants to start moving, any ideas how to solve it?

  • Counter of visits looks broken.

    http://scr.hu/1yl7/7uqyt[/code:aihsd0p0]
    
    Don't tell me it's fake, because nearly everyday I'm on forum. @Tom, some explainations?
  • Try to pack archive with 7zip and use deflate algorithm to compress archive.

    http://scr.hu/1yl7/zqelc[/code:15lnoo79]
    
    Also max file size for upload might be set to 30MB and they don't write a good exception in code.
    Probably they use ZipArchive extension for php, that's my guess.
  • frenzyace, I cannot PM to you, I don't have enough reputation points to your question in PM try change encoding settings in audio such as lower bitrate and codec. Should do the trick.

  • Thank you, appreciated That is good path. But there is small issue, my website uses iframe tag to publish my construct2 games and anybody can simply view source of my website, which means everybody can see path to my games. I read about that I cannot with 100% hide path to file in source, but I can make it harder to see it and more protect my work. So my guess is to use .htaccess.

    I simplify my question:

    How to raise 403 error (You don't have permission to this direcotry/file) when visitor enters in browser

    http : // loki.com /path_to_game/game_name/index.html (path displayed in iframe tag) but allow to them play game on http : // loki.com /index.php?section=games&game=game_title