Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

SRJ92

@SRJ92
About
Posts
57
Topics
28
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Ball to Ball collision handling
    S SRJ92

    Thanks :)

    JavaScript question javascript html game-dev performance

  • Ball to Ball collision handling
    S SRJ92

    hi, I have looked all over and can't find something that suits my needs... so here goes... I am creating a snooker game in HTML 5 canvas and JavaScript and have now came to the part of resolving the ball to ball collisions. So far I have this, which is great, it detects the cue ball hitting another ball:

    function isColliding(ball){
    var distance = Math.sqrt(((this.posX - ball.posX)*(this.posX - ball.posX)) + ((this.posY - ball.posY) * (this.posY - ball.posY)));

    if (distance < this.radius + ball.radius){
    //balls have collided now work out where they collided

    var collisionPointX = ((this.posX * ball.radius) + (ball.posX * this.radius)) / (this.radius + ball.radius);

    var collisionPointY = ((this.posY * ball.radius) + (ball.posY * this.radius)) / (this.radius + ball.radius);

    ball.speed = this.speed;

    this.directionX = Math.cos(?);

    this.directionY = Math.sin(?);

    ball.directionX = Math.cos(?);

    ball.directionY = Math.sin(?);

    }

    }

    However I need to know how do I work out the Math.cos and Math.sin for the balls to move in a direction that is expected (using elastic collision), when they collide? Thanks for help in advance.. Steve

    JavaScript question javascript html game-dev performance

  • onmouseover and document.getElementById
    S SRJ92

    Brilliant, thank you :)

    JavaScript help html database tools question

  • onmouseover and document.getElementById
    S SRJ92

    Hi! This has been bugging me for quite a while now... I have done many google searches but nothing seems to actually help me.... When i run this script i get the following error: "SCRIPT5007: Unable to set value of the property 'onmouseover': object is null or undefined" I don't know how it doesn't work but if i use onmouseover="show()" and obviosuly remake my function heading it works... I can't use the onmouseover="" as apparently its not the best way of doing it... Cna nayone shine some light on where it could be going wrong? Thanks for all your help!

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    		#gallery
    			{
    				position:relative;
    				display:block;
    				width:800px;
    				height:500px;
    				margin:20px auto;
    				text-align:center;
    			}
    		#image
    			{
    				display:block;
    				width:800px;
    				height:500px;
    			}
    		#imgBar
    			{
    				position:absolute;
    				display:block;
    				width:500px;
    				height:80px;
    				z-index:2;
    				top:400px;
    				left:145px;
    				display:none;
    			}		
    	
    	<script>
    		var galleryImg = document.getElementById('image');
    		var bar = document.getElementById('imgBar');
    		
    		galleryImg.onmouseover = function ()
    		{
    			bar.style.display = "block";
    		};
    		galleryImg.onmouseout = function ()
    		{
    			bar.style.display = "none";
    		};
    	</script>
    </head>
    <body>
    
    
    	![](#)
    	
    
    	![](img/gallery/thumbnail1.png)
    	![](img/gallery/thumbnail1.png)
    	![](img/gallery/thumbnail1.png)
    	![](img/gallery/thumbnail1.png)
    	
    
    
    
    </body>
    

    </html>

    JavaScript help html database tools question

  • JQuery Animate
    S SRJ92

    Hey, Any ideas why this won't work? i want the text and image to go back to the original position then repeat the previous animation, so the text goes out to the right then resets, and comes back in from the left, and the same for the image ..

    <
    <html>
    <head>
    <script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
    <script type="text/javascript">
    $(document).ready(function(){
    bringIn();
    function bringIn()
    {
    $("#animation_image").animate({top:10},"slow");
    $("#animation_text").animate({left:30},2000);
    window.setTimeout(takeOut, 5000);
    };
    function takeOut()
    {
    $("#animation_image").animate({top:401},"slow").queue(function(){
    $("#animation_text").animate({left:1000},"slow",bringIn);
    //new
    $("#animation_text").css({"left":"-600px"});
    $("#animation_image").css({"top":"-200px"});
    $("#animation_text").html("Why you no working");
    });
    };
    });

    </script>
    </head>

    <body>
    <button>Start Animation</button>

    #animation_box
    {
    position:relative;
    width:800px;
    height:300px;
    margin:0px auto 0px auto;
    background-color:#333333;
    overflow:hidden;
    }
    #animation_text
    {
    position:absolute;
    display:block;
    z-index:2;
    left:-600px;
    top:20px;
    width:300px;
    font-family:Arial, Helvetica, sans-serif;
    font-size:30px;
    line-height:45px;
    color:white;
    }
    #animation_image
    {
    position:relative;
    display:block;
    float:right;
    top:-200px;
    margin-right:10px;
    }
    <body>

    							First 3 hours £36
    						
    
    					
    
    					
    
    								![Car image](img/slides/img8.jpg)
    

    </body>
    </html>

    Thanks for all your help

    JavaScript javascript html css database com

  • Javascript and loading
    S SRJ92

    hello, i have a big javascript page that needs to be loaded and i was wondering if there is a way to put in a loading screen, as you know, with images they take time and sometimes other objects on the page can also create the user to wait a while so my question is how do i go about creating a loading screen which will detect when all images, content and functions have been loaded and then disappear when they have finished? do i use the windows.load event, if so is there such thing as a window.loaded event? Thanks for all your help i have been searching for hours and still cant really get anywhere Steve

    JavaScript question javascript algorithms help

  • The joys of PHP mail()
    S SRJ92

    turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?

    Linux, Apache, MySQL, PHP php com sysadmin collaboration beta-testing

  • The joys of PHP mail()
    S SRJ92

    <?php
    $to = "someone@domain.com";
    $subject = "Test";
    $message = "Hello";
    $from = "someonelse@domain.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>

    as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...

    Linux, Apache, MySQL, PHP php com sysadmin collaboration beta-testing

  • Cookies
    S SRJ92

    hello, i have been having a few issues with my cookies in php ..... First things first is this script below won't work at all... what am i doing wrong ?

    if (isset($_COOKIE["user"]) && ($_COOKIE["pass"]))
    {
    $user=$_COOKIE['user'];
    $pass=$_COOKIE['pass'];
    }else{
    $user=mysql_real_escape_string($_POST['username']);
    $pass=mysql_real_escape_string(hash('sha512', $_POST['password']));
    $remember = (isset($_POST['remember']));
    }

    However, if i take out all the bits in bold, it works perfectly .... The next thing is i tried a number of times to get my cookies to go back to the previous directory using things like "../" at the end but this doesn't seem to work ... what do i need to do to this script ..... Note: this file is 1 sub folder away from the root...

    if($remember == 1)
    {
    $expire=time()+60*60*24*30;
    setcookie ("user", "test", $expire);
    setcookie ("pass", $pass, $expire);
    }

    Thanks for all your help, steve

    Linux, Apache, MySQL, PHP php mysql cryptography tools help

  • Session destory error
    S SRJ92

    hi, i have created a member log in system which will change a page which is included on the homepage.... Ok, now when i log out it destroys the session fine but then i get this error "Notice: Undefined index: logged in ttab.php on line 4", how do i get rid of the error because on other pages it seems to go away ... Code for file which displays depending on session ... (ttab.php)

    <html><style>div{font-family:Arial;}</style><body>
    <?php
    session_start();
    if (!($_SESSION['logged']== true))
    {
    echo"<a href='memlogin.php?msg=0' id='flink'><div>Register/Log In</div></a>";
    }else{
    $name = $_SESSION['user'];
    echo"Welcome $name, &nbsp<a href='account.php' id='flink'>Account Options</a>&nbsp|&nbsp<a href='ref/logout.php'id='flink'>Log Out</a>";
    }
    ?>
    </body></html>

    Process that the log out does ... (logout.php)

    //Logout process
    session_start();
    session_destroy();
    header("location: ../index.php");

    Linux, Apache, MySQL, PHP question php html database help

  • Game Creation
    S SRJ92

    ok, thanks

    C# question css graphics game-dev help

  • Game Creation
    S SRJ92

    ok sorry, erm... what i want is to scrool the grid as the player moves from the right to the left so that the player can proceed through the level and it isn't all displayed at once i am using winforms to make my game

    C# question css graphics game-dev help

  • Game Creation
    S SRJ92

    Hello, i am creating a platformer with a scrolling grid, a bit like Mario ... I have my grid set up in an int of 10 by 100..... now there are onyl 13 squares displayed on the screen at one time in a 640 by 480 box .. this is stored in a struct and added as so : Grid.Grid = new int[GridWidth, GridHeight]; I am using _Paint to put my graphics onto the screen I have already set up this following code to scroll a background for the game when the player reaches a certain position

         if (Player.Location.X >= 13)
            {
                XOffset += 4;
                if (XOffset > bgnd.Width - this.Width)
                {
                    XOffset = bgnd.Width - this.Width;
                }
            }
            else
            {
                Player.Location.X += 1;
    
            }
        }
    

    so i have some idea of what goes on , but i am stuck :O so, my question is this ..... How do i make the Grid scroll?

    C# question css graphics game-dev help

  • Data labels ?
    S SRJ92

    Thank you ever so much :P

    C# database security help question

  • Data labels ?
    S SRJ92

    hello, i can't get it to work and i have spent another 3 hours trying differant ways lol, can you help me ?

    C# database security help question

  • Data labels ?
    S SRJ92

    Thank you i shall try that :P

    C# database security help question

  • Data labels ?
    S SRJ92

    sorry, my other post wasn't clear ... hello, i want to create a more complex highscore board that displays the playname and score in labels! currently i have a datagrid which is displaying my data as a test, here is my code for that:

            OLEDataConnector Dat = new OLEDataConnector("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\"Highscore.accdb\\";Persist Security Info=False;");
            DataTable Dt = new DataTable();
            Dat.dataSelect("select Playername, Score, LevelNumber from score order by score desc", ref Dt);
            dataGridView1.DataSource = Dt.DefaultView;
    

    its a microsoft access database and i need to get around 10 rows if they are in the database to be put onto my highscore board ... So what i want is the playername of the record to be put into one label and the other as a score in another label, obviosuly they will move around using the query, :P Any help? as i can't find anything on this that is of any use.... Thanks

    C# database security help question

  • Database Data [modified]
    S SRJ92

    hello, i want to create a more complex highscore board that displays the playname and score in labels! currently i have a datagrid which is displaying my data as a test, here is my code for that:

            OLEDataConnector Dat = new OLEDataConnector("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\"Highscore.accdb\\";Persist Security Info=False;");
            DataTable Dt = new DataTable();
            Dat.dataSelect("select Playername, Score, LevelNumber from score order by score desc", ref Dt);
            dataGridView1.DataSource = Dt.DefaultView;
    

    its a microsoft access database and i need to get around 10 rows if they are in the database to be put onto my highscore board ... So what i want is the playername of the record to be put into one label and the other as a score in another label, obviosuly they will move around using the query, :P Any help? as i can't find anything on this that is of any use.... Thanks

    modified on Thursday, November 11, 2010 5:11 PM

    C# database security help question

  • USer Control Error
    S SRJ92

    hi, ever since i put in a user control, my other buttons don't work why is this ? The form opens with this user control then once the user clicks "start" it disappears (visible = false) and displays the game behind it, this is the delicate code... for the Delicate for the useer control

        void usrMenu1\_ClickMenu(string Button)
       {
           switch (Button)
           {
               case "Start":
                   Gameplay = true;
                   usrMenu1.Visible= usrSettings1.Visible = false;
                   usrMenu1.Hide();
                   usrSettings1.Hide();
                   break;
                case "Settings":
                usrMenu1.Visible = false;
                usrSettings1.Visible = true;
                   break;
           }
        }
    

    This is the button control..

    private void FrmGame_KeyDown(object sender, KeyEventArgs e)
    {
    if(Gameplay == true)
    {
    if (e.KeyCode == Keys.Up)
    {
    if (U == true)
    {
    //tim_Player.Enabled = true;
    Player.Direction = 1;
    Player.Normal = new Bitmap("images\\playerup.png");
    U = true;
    R = true;
    L = true;
    D = false;
    }
    }
    if (e.KeyCode == Keys.Right)
    {
    if (R == true)
    {
    Player.Normal = new Bitmap("images\\playerright.png");
    //tim_Player.Enabled = true;
    Player.Direction = 3;
    L = false;
    R = true;
    D = true;
    U = true;
    }
    }
    if (e.KeyCode == Keys.Down)
    {
    if (D == true)
    {
    Player.Normal = new Bitmap("images\\playerdown.png");
    //tim_Player.Enabled = true;
    Player.Direction = 2;
    R = true;
    L = true;
    U = false;
    D = true;
    }
    }
    if (e.KeyCode == Keys.Left)
    {
    if (L == true)
    {

    C# graphics game-dev help question

  • Keys and Disabling
    S SRJ92

    thanks everyone, helped me a lot, :D

    C# tutorial game-dev question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups