Changeset 34463

Show
Ignore:
Timestamp:
07/18/09 00:04:57 (4 years ago)
Author:
eller
Message:

戦車と砲弾もOBAQで処理するように変更。

Location:
lang/hsp/misc/obaq_battletank
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/hsp/misc/obaq_battletank/bomb.as

    r34461 r34463  
    1 #module m_bomb x, y, angle, speed 
    2 #modinit double p_x, double p_y, double p_angle 
    3         x = p_x 
    4         y = p_y 
    5         angle = p_angle 
    6         speed = 5.0 
    7         return 
    8  
    9 #modfunc move_bomb 
    10         x += speed * cos(angle) 
    11         y += speed * sin(angle) 
    12         speed -= 0.1 
    13         return 
    14  
    15 #modfunc draw_bomb 
    16         circle x - 10, y - 10, x + 10, y + 10, 0 
     1#module m_bomb obaq_id, life 
     2#const double SPEED_MAX 0.6 
     3#modinit double obaq_x, double obaq_y, double angle 
     4        qaddpoly@ obaq_id, 20, obaq_x, obaq_y, angle, 5, 5, colsw_none@, MY_WEAPON_GROUP@, MY_GROUP@ 
     5        speed_x = SPEED_MAX * cos(angle) 
     6        speed_y = SPEED_MAX * sin(angle) 
     7        qspeed@ obaq_id, speed_x, speed_y, 0.0, 1 
     8        qinertia@ obaq_id, 0.97, 1.0 
     9        life = 20 
    1710        return 
    1811 
    1912#modfunc burst_bomb 
    20         qcnvaxis@ scr_x, scr_y, x, y, 1 
    21         qblast@ scr_x, scr_y, 3, 1, 20 
    22         title "x:" + x + "\ty:" + y 
     13        qgetpos@ obaq_id, obaq_x, obaq_y, angle 
     14        qblast@ obaq_x, obaq_y, 3, 1, 20 
     15        qdel@ obaq_id 
     16         
     17        qcnvaxis@ scr_x, scr_y, obaq_x, obaq_y, 0 
     18        color 255 
     19        circle scr_x - 30, scr_y - 30, scr_x + 30, scr_y + 30, 1 
    2320        return 
    2421 
    2522#modfunc __burst 
    26         return speed < 0.3 
     23        life-- 
     24        return life < 0 
    2725 
    28 #defcfunc need_to_burst var p_bomb 
    29         __burst p_bomb 
     26#defcfunc need_to_burst var bomb 
     27        __burst bomb 
    3028        return stat 
    3129#global 
  • lang/hsp/misc/obaq_battletank/obaq_battletank.hsp

    r34461 r34463  
    11#include "obaq.as" 
     2#const MY_GROUP         0x00000001 
     3#const ENEMY_GROUP      0x00000010 
     4#const MY_WEAPON_GROUP  0x00000100 
     5 
    26#include "bomb.as" 
    37#include "tank.as" 
     
    812        qreset 
    913        qgravity 0, 0 
    10         dimtype bomb_list, DIMTYPE_MODULE, 16 
     14        qborder -60, -50, 60, 50 
     15        dimtype bomb_list,   DIMTYPE_MODULE, 16 
     16        dimtype target_list, DIMTYPE_MODULE, 16 
    1117 
    12         hako=10 
    13         repeat 100 
    14                 if hako=0 : break 
    15                 qaddpoly my, 15, rnd(ginfo_winx), rnd(ginfo_winy),0,5,5         ; ���p�`��� 
    16                 if my>=0 { 
    17                         hako-- 
    18                 } 
     18*create_targets 
     19        repeat length(target_list) 
     20                x = rnd(100) 
     21                y = rnd(80) 
     22                qaddpoly target_list(cnt), 15, x, y, 0, 5, 5, colsw_none, ENEMY_GROUP 
     23                if target_list(cnt) < 0 : continue cnt 
    1924        loop 
    2025         
     
    2328 
    2429*main 
    25         redraw 0                ; ���̍X�V��n 
     30        redraw 0                        ; ���̍X�V��n 
    2631        gradf ,,,,1,0,128       ; ���N���A 
    27         qexec                   ; OBAQ�ɂ��I�u�W�F�N�g�̍X�V 
     32        qexec                           ; OBAQ�ɂ��I�u�W�F�N�g�̍X�V 
    2833 
    2934        stick key, 15           ; �L�[�̎擾 
    3035        if key&128 : end 
    31         if key&2  : move_tank tank 
    32         rotate = (key & 1) - ((key >> 2) & 1) 
    33         rotate_tank tank, 0.1 * rotate 
     36        direction = ((key >> 1) & 1) - ((key >> 3) & 1) 
     37        rotation  = ((key >> 2) & 1) - (key & 1) 
     38        accel_tank tank, direction, 0.01 * rotation 
    3439 
    3540        if key&16 { 
     
    3742        } 
    3843 
    39         qdraw                   ; �I�u�W�F�N�g�̕`�� 
    40         color 255,255,255 
    41         qcnvaxis x,y,xx,yy 
    42  
    43         draw_tank tank 
    4444        foreach bomb_list 
    45                 move_bomb bomb_list(cnt) 
    46                 draw_bomb bomb_list(cnt) 
    4745                if need_to_burst(bomb_list(cnt)) { 
    4846                        burst_bomb bomb_list(cnt) 
     
    5149        loop 
    5250 
     51        qdraw                   ; �I�u�W�F�N�g�̕`��     draw_tank tank 
     52         
     53 
    5354        redraw 1                ; ���̍X�V��� 
    5455        await 16                ; �����ԑ҂� 
  • lang/hsp/misc/obaq_battletank/tank.as

    r34461 r34463  
    1 #module m_tank x, y, angle 
    2 #const double SPEED 3.0 
    3 #modinit double p_x, double p_y, double p_angle 
    4         x = p_x 
    5         y = p_y 
    6         angle = p_angle 
     1#module m_tank obaq_id 
     2#include "hspmath.as" 
     3#const double SPEED 0.4 
     4#modinit double scr_x, double scr_y, double angle 
     5        qcnvaxis@ obaq_x, obaq_y, scr_x, scr_y, 1 
     6        qaddpoly@ obaq_id, 5, obaq_x, obaq_y, angle, 10.0, 10.0, colsw_none@, MY_GROUP@, MY_GROUP@ 
    77        return 
    88 
    9 #modfunc move_tank 
    10         x += SPEED * cos(angle) 
    11         y += SPEED * sin(angle) 
    12         return 
    13  
    14 #modfunc rotate_tank double p_angle 
    15         angle += p_angle 
    16         return 
    17  
    18 #modfunc shoot array list 
    19         newmod list, m_bomb, x, y, angle 
     9#modfunc accel_tank int direction, double rotation 
     10        qgetpos@ obaq_id, obaq_x, obaq_y, angle 
     11        speed_rot = rotation 
     12        speed_x = SPEED * cos(angle) * sgn(direction) 
     13        speed_y = SPEED * sin(angle) * sgn(direction) 
     14        qspeed@ obaq_id, speed_x, speed_y, rotation, 1 
    2015        return 
    2116 
    2217#modfunc draw_tank 
    23         theta = M_PI / 4 + angle 
    24         pos x + cos(theta) * 20, y + sin(theta) * 20 
    25         repeat 4, 1 
    26                 theta += M_PI / 2 
    27                 line x + cos(theta) * 20, y + sin(theta) * 20 
    28         loop 
     18        qgetpos@ obaq_id, obaq_x, obaq_y, angle 
     19        qcnvaxis@ scr_x, scr_y, obaq_x, obaq_y, 0 
     20        color 255, 255, 255 
     21        line scr_x, scr_y, scr_x + cos(angle) * 40, scr_y + sin(angle) * 40 
     22        return 
     23 
     24#modfunc shoot array bomb_list 
     25        qgetpos@ obaq_id, obaq_x, obaq_y, angle 
     26        newmod bomb_list, m_bomb, obaq_x, obaq_y, angle 
    2927        return 
    3028#global