 |
|
Exchange Forum >
AutoCAD Games
Play this ball |
|
|
|
|
|
|
|
Adesu |
 |
|
Join Date: |
|
10-03-2007 | |
Ah...if you still lazy or bore, play this ball
Code:
; bttd is stand for Ball Top To Down
; Design by : Adesu <Ade Suharna>
; Email : mteybid@yuasabattery.co.id
; Homepage : http://www.yuasa-battery.co.id
; Website : http://cadesu.multiply.com
; Create : 09 October 2007
; Program no.: 0664/10/2007
; Edit by :
(defun donut (pt)
(setq irad 0.0)
(setq orad 2.5)
(command "_donut" irad orad pt "" "")
(princ)
) ; defun
(defun topdown ()
(setq cnt 0)
(repeat
10
(setq pt (list 5 (+ 10 cnt) 0))
(donut pt)
(command "_erase" "l" "")
(setq cnt (1- cnt))
) ; repeat
) ; defun
(defun downtop ()
(setq cnt 0)
(repeat
10
(setq pt (list 5 (- 0 cnt) 0))
(donut pt)
(command "_erase" "l" "")
(setq cnt (1- cnt))
) ; repeat
) ; defun
(defun c:bttd (/ irad orad cnt pt)
(repeat
10
(topdown)
(downtop)
) ; repeat
(princ)
) ; defun
| |
|
|
|
Willie |
 |
|
Join Date: |
|
08-14-2007 | |
Adesu,
I thought you said "play this ball". I'm bored so I tried your game. I kept on hitting the ball, but didn't score any points. You're too fast for me. 
Willie
| |
|
|
|
isoplane |
 |
|
Join Date: |
|
07-27-2007 | |
I don't think he's keeping score dude! 
| |
|
|
|
Terry Cadd |
 |
|
Join Date: |
|
09-10-2007 | |
Adesu,
You're teasing us with this ball. We can't pick it and get points. Can you make it bounce around the screen? Here is a function that you can use to determine the extents of the users AutoCAD drawing area.
Code:
(defun ViewExtents (/ A B C D X)
(setq B (getvar "VIEWSIZE")
A (* B (/ (car (getvar "SCREENSIZE")) (cadr (getvar "SCREENSIZE"))))
X (trans (getvar "VIEWCTR") 1 2)
C (trans (list (- (car X) (/ A 2.0)) (+ (cadr X) (/ B 2.0))) 2 1)
D (trans (list (+ (car X) (/ A 2.0)) (- (cadr X) (/ B 2.0))) 2 1)
);setq
(list C D)
);defun ViewExtents
| |
|
|
|
Terry Cadd |
 |
|
Join Date: |
|
09-10-2007 | |
Adesu,
Here's another version of your bouncing ball for you to try.
Terry 
Code:
(defun c:BBB (/ Ang Dia Dist Entity Extents@ Loop P1 P2 X XL XR Y YB YT)
(setq Extents@ (ViewExtents)
XL (caar Extents@)
YT (cadar Extents@)
XR (caadr Extents@)
YB (cadadr Extents@)
P1 (getvar "VIEWCTR")
Ang (/ (angle P1 (car Extents@)) 3.0)
Dist (/ (distance (car Extents@)(cadr Extents@)) 40.0)
Dia (/ Dist 0.5)
Loop t
);setq
(command "DONUT" 0 Dia P1 "")
(command "CHPROP" "L" "" "C" "5" "");Choose your color
(setq Entity (entlast))
(setq Old_error *error* *error* BBB_error)
(while Loop
(command "DELAY" 10)
(setq P2 (polar P1 Ang Dist)
X (car P2)
Y (cadr P2)
);setq
(cond
((and (< X XL)(< Ang pi))
(setq Ang (radians (+ (- pi Ang) 0.1)))
);case
((< X XL)
(setq Ang (radians (- (- (* pi 2) (- Ang pi)) 0.1)))
);case
((and (> X XR)(> Ang pi))
(setq Ang (radians (+ (+ pi (- (* pi 2) Ang)) 0.1)))
);case
((> X XR)
(setq Ang (radians (- (- pi Ang) 0.1)))
);case
((and (< Y YB)(< Ang (* pi 1.5)))
(setq Ang (radians (+ (- pi (- Ang pi)) 0.1)))
);case
((< Y YB)
(setq Ang (radians (- (- (* pi 2) Ang) 0.1)))
);case
((and (> Y YT)(> Ang (* pi 0.5)))
(setq Ang (radians (- (+ pi (- pi Ang)) 0.1)))
);case
((> Y YT)
(setq Ang (radians (+ (- (* pi 2) Ang) 0.1)))
);case
);cond
(if (or (< X XL)(> X XR)(< Y YB)(> Y YT))
(setq P2 P1)
);if
(command "MOVE" Entity "" P1 P2)
(setq P1 P2)
);while
);defun c:BBB
(defun BBB_error (msg)
(command "ERASE" Entity "")
(setq *error* Old_error Old_error nil)
(princ)
);defun BBB_error
; radians - Fixes radian angle calculations greater than 2pi or less than 0
; Arguments: 1
; Angle~ = Angle in radians
; Returns: Angle in radians fixed
(defun radians (Angle~ /)
(if (or (< Angle~ 0)(>= Angle~ (* pi 2)))
(setq Angle~ (- (* pi 2) (abs Angle~)))
);if
Angle~
);defun radians
; ViewExtents
; Returns: List of upper left and lower right points of current view
(defun ViewExtents (/ A B C D X)
(setq B (getvar "VIEWSIZE")
A (* B (/ (car (getvar "SCREENSIZE")) (cadr (getvar "SCREENSIZE"))))
X (trans (getvar "VIEWCTR") 1 2)
C (trans (list (- (car X) (/ A 2.0)) (+ (cadr X) (/ B 2.0))) 2 1)
D (trans (list (+ (car X) (/ A 2.0)) (- (cadr X) (/ B 2.0))) 2 1)
);setq
(list C D)
);defun ViewExtents
| |
|
|
|
Willie |
 |
|
Join Date: |
|
08-14-2007 | |
Can you slow this thing down? I can't even move my mouse that fast. How do you expect me to win?
| |
|
|
|
isoplane |
 |
|
Join Date: |
|
07-27-2007 | |
You can slow it down by changing the line, (command "DELAY" 10), to a higher number, but he's still not going to let you win. It's not a game dude!
| |
|
|
|
|
|