Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Why does x coordinate make a difference? #382192
09/05/11 16:34
09/05/11 16:34
Joined: Sep 2011
Posts: 1
R
rpframe Offline OP
Guest
rpframe  Offline OP
Guest
R

Joined: Sep 2011
Posts: 1
I am trying to learn how to use this software, but I am totally new to programming, 3D modeling and everything else I am trying to do. In order to understand, I need to make a game myself. Otherwise, I won’t remember anything. I am trying to make a 2D game that will sort pictures. (It is for my autistic son who learns visually and of course, loves video games. I am hoping to be able to modify it for vocabulary he needs to learn for school.) So far, I made bitmaps for solid, liquid and gas. I used the button code from the workshop #6 that shuts down the engine, but I took the shutdown part out and replaced it with making a sound. The odd thing is I only the gas button worked. Here is the code I was using:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
BMAP* cursor_pcx = "cursor.pcx";
BMAP* apple_bmp = "apple.bmp";
///////////////////////////////
SOUND* beep1_wav = "beep1.wav";
SOUND* beep2_wav = "beep2.wav";
SOUND* goal_wav = "gotkey.wav";
///////////////////////////////
function main( )
{
video_screen = 1;
video_mode = 7;
screen_color.blue = 150;
}
///////////////////////////////
function mouse_startup()
{
mouse_mode = 2; //show the mouse curser
mouse_map = cursor_pcx; // set the mouse pointer bitmap
while (1)
{
vec_set(mouse_pos, mouse_cursor);
wait(1);
}
}
///////////////////////////////
function mouse_event()
{
if (event_type == EVENT_CLICK)
{
snd_play(beep1_wav,100,0);
}
}
action sound_on_click()
{
my.emask |= ENABLE_CLICK;
my.event = mouse_event;
}
///////////////////////////////
PANEL* solid_pan = // solid
{
button(125, 50, "solidred.bmp", "solidnorm.bmp", "solidyellow.bmp", mouse_event, NULL, NULL);
flags = OVERLAY | SHOW;
}
///////////////////////////////
PANEL* liquid_pan = // liquid
{
button(310, 50, "liquidred.bmp", "liquidnorm.bmp", "liquidyellow.bmp", mouse_event, NULL, NULL);
flags = OVERLAY | SHOW;
}
///////////////////////////////
PANEL* gas_pan = // gas
{
button(500, 50, "gasred.bmp", "gasnorm.bmp", "gasyellow.bmp", mouse_event, NULL, NULL);
flags = OVERLAY | SHOW;
}
///////////////////////////////

After much research and reading and trying different things, I called in my husband and son who know a lot more than I do about computers. The moved things around and tried different things. When they switched the x and y coordinates on the liquid and gas panels then liquid and gas worked, but not solid. What finally worked was putting gas at x=125 and y=50, liquid at x=310 and y=50, and solid at x=500 and y=50. Why didn’t it work before or only partly until they were in that order? The only thing I can think of is that they need to be in alphabetical order but that doesn’t make sense to me. Why would the computer care? I need to understand so I won’t make the same mistake when I modify the program for other categories.

Thank you for your explanations in advance. If I posted in the wrong place. Sorry. I really am new so I thought I would start in the beginner forum.
rpframe

Re: Why does x coordinate make a difference? [Re: rpframe] #382203
09/05/11 18:55
09/05/11 18:55
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Maybe, it simply didn't work because of the intersection of the different panels.
You didn't set any position of the panels, so each of them is at position pos_x = 0 and pos_y = 0.

I didn't test it with sounds, but for the things you tried you only need one panel with the three buttons and give each button a simple function with snd_play - no different panels needed, and no event_click needed.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1