Go Back   Rage3D » Rage3D Discussion Area » Gaming and Computing Forums » General Software » Programmers Discussion Forum
Rage3D Subscribe Register FAQ Members List Calendar Mark Forums Read

Programmers Discussion Forum Use this discussion forum to talk about the art of programming. Everything from website development to 3D graphics programming should go in here.

Reply
 
Thread Tools Display Modes
Old Nov 3, 2016, 11:52 AM   #1
Advertisement (Guests Only)

Login or Register to remove this ad
night
Radeon Arctic Islands
 
Join Date: Jul 2002
Location: houston
Posts: 10,670
night can beat 'Minesweeper' on any difficultynight can beat 'Minesweeper' on any difficulty


Default Any javascript/canvas pros?

I'm losing my mind trying to get collision/bounce in a circle to work right. I've looked at a dozen examples and tried to adapt to my school project but it always ends up inconsistent. And this is just on one part, haven't even tried to adapt to the smaller inside curve yet .
This is all for a web development class project. I really wanted to do something more graphic related instead of everyone elses word games, but it's kinda kicking my ass.

here is the full mess

or here is the specific piece
Code:
this.move = function() {
    if (this.firetravel > 0) {
        myGameArea.context.fillStyle = color;
        myGameArea.context.beginPath();
        myGameArea.context.arc(this.x, this.y, this.r, 0, Math.PI*2);
        myGameArea.context.closePath();
        myGameArea.context.fill();


              // here to ...
        dx = this.x-640;
        dy = this.y-720;
        dist = Math.sqrt(dx*dx + dy*dy);
            //this.angle = Math.atan2(dy,dx);
        dir = Math.atan2(this.y, this.x);
        
            //newdir = 2*dir - 
        if (dist > 600) {
            this.xmove *= Math.cos(dir - this.angle);
            this.ymove *= Math.sin(dir - this.angle);
        }
              // ... here is the extent of the angle/bounce code. Aiming 45* to the
              //  will bounce it some, but the rest is fail. plus some aborted code I
              //  left in but can't fit it into mine. (this code cleaned up for readability)

        this.x += this.xmove * this.speed;
        this.y += this.ymove * this.speed;
    }
}
__________________
However, I am in the extreme minority, and I understand that there is something fundamentally wrong with me

Last edited by night : Nov 3, 2016 at 11:58 AM.
night is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ATI FirePro™ S400 Synchronization Module Creates Smooth Virtual Canvas.... Android1 Front Page News 0 Jul 28, 2009 11:35 AM
ATI FirePro™ S400 Synchronization Module Creates Smooth Virtual Canvas.... Android1 Professional Graphics Discussion 0 Jul 28, 2009 11:35 AM
Meteos or Kirby: Canvas Course? WhO_KnOwS Console Gaming 5 Sep 2, 2005 12:39 PM
Kirby canvas curse commercial CowboyBebop Console Gaming 6 Jun 19, 2005 07:24 PM


All times are GMT -5. The time now is 09:47 PM.



Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
All trademarks used are properties of their respective owners. Copyright ©1998-2011 Rage3D.com
Links monetized by VigLink