# Frogger Offset Help!

hello, I’m doing an exercise to practice offset. I’m currently working on a game of frogger to apply this but dont know where to start. how should i apply apply the offset to make the object move in a direction and then the other objects move relative to it.

this is what i have to draw the objects

``````void drawHazard(int type, float x, float y, float size)
{
if (type == 0)
{
fill(255,0,0);
ellipse(x,y,size,size);

}
if (type == 1)
{
fill(0);
rect(x,y,size,size);
}
if (type == 2)
{
fill(255);
ellipse(x,y,size,size);
}
}

void drawHazards()
{

for (int j=0;j<width;j++)
{
for (float i=0;i<level+2;i++)
{
float y0 = (height-bandHeight*1.5)-i*(bandHeight*3);
if (y0 < bandHeight)
{
y0 = height-bandHeight*1.5;
}
float y1 = (height-bandHeight*2.8)-i*(bandHeight*3);
if (y1 < bandHeight)
{
y1 = height-bandHeight*2.8;
}
float y2 = (height-bandHeight*3.5)-i*(bandHeight*3);
if (y2 < bandHeight)
{
y2 = height-bandHeight*3.5;
}
x0 = j*(bandHeight*3);
x1 = j*(bandHeight*4)-((bandHeight-50)/2);
x2 = j*(bandHeight*5);
drawHazard(0,x0,y0,bandHeight/1.5);
drawHazard(1,x1,y1,bandHeight/1.5);
drawHazard(2,x2,y2,bandHeight/1.5);

}

}

}
``````

Thanks in advance for the help

1 Like

please post a runable code and not only a small bit.
Please explain what you want to achieve.
{"ft_lang_label":"__label__en","ft_lang_prob":0.64351624,"math_prob":0.9985362,"size":1152,"snap":"2022-27-2022-33","text_gpt3_token_len":398,"char_repetition_ratio":0.21341464,"word_repetition_ratio":0.0,"special_character_ratio":0.36979166,"punctuation_ratio":0.21481481,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9810835,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-05T04:25:39Z\",\"WARC-Record-ID\":\"<urn:uuid:a64e72d1-2094-455a-a511-554aaa85508f>\",\"Content-Length\":\"19416\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:aada2ea8-e6a7-440a-867d-f0871c5219bc>\",\"WARC-Concurrent-To\":\"<urn:uuid:0860b215-87fc-472c-ba2f-39884b70cebf>\",\"WARC-IP-Address\":\"64.62.250.111\",\"WARC-Target-URI\":\"https://discourse.processing.org/t/frogger-offset-help/18842\",\"WARC-Payload-Digest\":\"sha1:WGNHUE7SSJKAQZ46LI3WFXJWWQPLAI6M\",\"WARC-Block-Digest\":\"sha1:SB4KG6YFEVZ4YICBNNWBC6OU4BXWBAGI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104512702.80_warc_CC-MAIN-20220705022909-20220705052909-00626.warc.gz\"}"}